-
Notifications
You must be signed in to change notification settings - Fork 27
Make it more unlikely for content builds to get stuck in a running state #527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1b62fec to
f33f14b
Compare
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
bc50472 to
f33f14b
Compare
…build run` subcommand
Makefile
Outdated
| CONNECT_CONTENT_BUILD_DIR="rsconnect-build-test" \ | ||
| CONNECT_SERVER="http://$(HOSTNAME):3939" \ | ||
| CONNECT_API_KEY="0123456789abcdef0123456789abcdef" \ | ||
| CONNECT_API_KEY="21232f297a57a5a743894a0e4a801fc3" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did we rotate credentials at some point? Just making sure I'm following why this change is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was a static api key that mock_connect was expecting. I changed it to the insecure admin api key (echo -n admin | md5sum) since that's what we use in dev, but this is removed in my next PR anyway
| # make sure that we always mark the build as complete but note | ||
| # there's no guarantee that the content_executor or build_monitor | ||
| # were allowed to shut down gracefully, they may have been interrupted. | ||
| _content_build_store.set_build_running(False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with this setup, its still possible to ^C into a weird state, right? Just significantly less likely if we set the state of the build first thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's right. I'm hoping this covers most cases. It could still happen on slow filesystems but this makes it less likely in most scenarios. If the problem persists after this change then we can look at removing the safety check.
The reason it exists in the first place is to stop users from modifying the state file while there's a build running. The 3 commands that modify the local start are content build [run, add, rm].
edit:
probably a better alternative than removing the safety check is to provide an "are you sure?" dialog if they attempt to start another build when the local state says there's a build already running. This will allow them to get unstuck without manually updating the state file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I completely agree with the approach here - just making sure I am following what's going on.
| store = ContentBuildStore(RSConnectServer(connect_server, api_key)) | ||
| store.set_content_item_build_status(_content_guids[0], BuildStatus.RUNNING) | ||
|
|
||
| # run the build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think its a blocker or anything, but you could also add some tests for the other hidden flags that are considered when a retry is executed if you wanted to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add this in my followup PR before this gets merged to main to avoid a merge conflict
|
do we need to document the new flag somewhere? |
Deprecate mock_connect and fix test_main_content tests
Intent
Interrupting a long-running
rsconnect content build runcommand with^Cwill now update the local state file before attempting graceful cleanup. This
should help prevent users from getting stuck a "build already running" state.
Fixes #467
Type of Change
Approach
content build run --running--retrythat will start a build for all content marked asRUNNING,ABORTED,NEEDS_BUILDorERROR--running,--aborted, and--errorflags as hidden. Most people will probably want to use--retryanyway but the more specific flags can still be used if needed.Automated Tests
Added a new test for
--retryintest_main_content.pyDirections for Reviewers
The tests in
test_main_content.pyrequiremock_connectI would recommend updating
scripts/runteststo say:pytest ${PYTEST_ARGS} --mypy ./tests/test_main_content.pyso that you can run only the content tests locally since they are skipped in CI.
I've also created a followup to deprecate mock_connect. We should move to
httprettyinstead for mocking which is already used bytest_main.pyand part of this follow up we can start running these tests in CI again without mock_connect.Checklist