Skip to content
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

scheduled stop #431

Merged
merged 85 commits into from
Jan 15, 2025
Merged
Changes from 1 commit
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
a29169e
Add stopping state.
alexhsamuel Dec 9, 2024
d1da248
Add stop config for Job.
alexhsamuel Dec 11, 2024
a39f372
Fix exception.
alexhsamuel Dec 13, 2024
21cb516
Stop schedules.
alexhsamuel Dec 13, 2024
8323f99
Refactor Schedule JSO logic.
alexhsamuel Dec 13, 2024
9063032
Just one schedule, no conds or actions.
alexhsamuel Dec 13, 2024
7361780
Attach StopSchedule to Schedule, but make them siblings in JSO.
alexhsamuel Dec 13, 2024
e8e9afd
Notes.
alexhsamuel Dec 13, 2024
5130ebf
Rename to stop_schedule.
alexhsamuel Dec 13, 2024
b93d8aa
Test.
alexhsamuel Dec 13, 2024
25b5c57
Get rid of Stop class.
alexhsamuel Dec 13, 2024
5cc2af9
Simplify stop schedule.
alexhsamuel Dec 13, 2024
ec8fd4e
We always go through the scheduled state.
alexhsamuel Dec 13, 2024
9a4439b
Set stop time in run.times.
alexhsamuel Dec 13, 2024
1048979
Update design notes.
alexhsamuel Dec 13, 2024
ba0d364
Todo.
alexhsamuel Dec 13, 2024
83fdd4b
Fix.
alexhsamuel Dec 13, 2024
cb05b2a
Set up to use stop time.
alexhsamuel Dec 13, 2024
de98cfe
Add FIXME.
alexhsamuel Dec 15, 2024
8b0c25d
Merge branch 'master' into feature/scheduled-stop
alexhsamuel Dec 17, 2024
f45b537
Provisional stop logic.
alexhsamuel Dec 17, 2024
7fbbc1b
Update .gitignore.
alexhsamuel Dec 17, 2024
ca714c2
Clean up logic.
alexhsamuel Dec 17, 2024
27f4640
Change stop time recording in run log.
alexhsamuel Dec 17, 2024
2e0506d
Update design.
alexhsamuel Dec 17, 2024
14ec55d
Add stop() to Program API.
alexhsamuel Dec 17, 2024
5e9cca1
stop() for no-op program.
alexhsamuel Dec 17, 2024
eecf760
Use Program.stop() for scheduled stop.
alexhsamuel Dec 17, 2024
fde2309
Add stop_time to schedule API.
alexhsamuel Dec 17, 2024
b3ad244
Todo.
alexhsamuel Dec 17, 2024
09c47c7
Todo.
alexhsamuel Dec 17, 2024
de6e3cf
Move _process_updates into its own module.
alexhsamuel Dec 17, 2024
a6e57dd
Fix.
alexhsamuel Dec 17, 2024
0082f77
Fix.
alexhsamuel Dec 17, 2024
9f59405
Allow signal while stopping.
alexhsamuel Dec 17, 2024
4c07602
Transition to stopping when stopping.
alexhsamuel Dec 17, 2024
4b2a177
Front end changes for stopping state.
alexhsamuel Dec 17, 2024
459e52d
Fixes.
alexhsamuel Dec 17, 2024
6f83ade
Update todo.
alexhsamuel Dec 17, 2024
a159f72
Split bound program, and fix stop.
alexhsamuel Dec 17, 2024
f3810ee
Procstar agent program stop implementation.
alexhsamuel Dec 17, 2024
d191cfd
Todo.
alexhsamuel Dec 18, 2024
e0d3a6f
Stopped run can succeed, WIP doesn't work.
alexhsamuel Dec 18, 2024
2b3a547
Refactor.
alexhsamuel Dec 19, 2024
ebd214f
Program may be missing in response.
alexhsamuel Dec 20, 2024
414b161
Running program object support and for no-op program.
alexhsamuel Dec 20, 2024
f818888
Reorganize module.
alexhsamuel Dec 20, 2024
543998d
ProcstarProgramRunning, WIP.
alexhsamuel Dec 20, 2024
d948b2a
Fixes.
alexhsamuel Dec 20, 2024
226115b
Support legacy programs in with RunningProgram.
alexhsamuel Dec 21, 2024
ea33b77
Fix.
alexhsamuel Jan 5, 2025
24600f5
RunningProgram for Procstar agent program.
alexhsamuel Jan 5, 2025
b9cb617
Fix running program for classic agent.
alexhsamuel Jan 5, 2025
f6c577e
Clean up.
alexhsamuel Jan 5, 2025
2ac12f6
Todo.
alexhsamuel Jan 5, 2025
3400fd6
Clean up no longer used.
alexhsamuel Jan 5, 2025
4299725
Fix stopping transition.
alexhsamuel Jan 5, 2025
08f7968
Record stop signals sent in meta.
alexhsamuel Jan 5, 2025
a31362f
Clean up.
alexhsamuel Jan 5, 2025
598ba04
Show stop time in run view.
alexhsamuel Jan 5, 2025
691f4ff
Test job.
alexhsamuel Jan 6, 2025
be75ee0
Add stop time to runs table.
alexhsamuel Jan 6, 2025
fcebe46
Procstar stop tests.
alexhsamuel Jan 6, 2025
be220a9
Another test.
alexhsamuel Jan 6, 2025
278a559
Update unit tests.
alexhsamuel Jan 7, 2025
ac644e5
Unit tests for ProcessProgram.
alexhsamuel Jan 7, 2025
b36bd13
Add BoundProcessProgram.
alexhsamuel Jan 7, 2025
88bb540
RunningProgram for process programs; factor out common Stop.
alexhsamuel Jan 8, 2025
e96257b
Round-trip JSO tests for programs.
alexhsamuel Jan 8, 2025
0677fd6
Todo.
alexhsamuel Jan 8, 2025
4af21a8
Clean up imports.
alexhsamuel Jan 8, 2025
27af132
Clean up import.
alexhsamuel Jan 8, 2025
e388e88
Stop run in API.
alexhsamuel Jan 8, 2025
5ea1c23
Proper stop behavior in process program.
alexhsamuel Jan 8, 2025
5256631
Agent stop tests.
alexhsamuel Jan 8, 2025
7a5f58e
Fix.
alexhsamuel Jan 8, 2025
db8c462
Fix.
alexhsamuel Jan 8, 2025
6533a06
Todo.
alexhsamuel Jan 8, 2025
1e50678
Stop operation in web UI.
alexhsamuel Jan 8, 2025
23b7bae
Stop operation in CLI.
alexhsamuel Jan 8, 2025
664bd4f
Todo.
alexhsamuel Jan 8, 2025
e0fb7e4
Fix states.
alexhsamuel Jan 9, 2025
e9429b3
Program stop docs.
alexhsamuel Jan 9, 2025
96363fa
Refactor.
alexhsamuel Jan 15, 2025
d7275fc
Docstring.
alexhsamuel Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Docstring.
  • Loading branch information
alexhsamuel committed Jan 15, 2025
commit d7275fc541314806aeb2adb895bd7693c17c8571
4 changes: 1 addition & 3 deletions notes/todo.md
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@
- [x] run log
- [x] improve and clean up `State` enum

- [ ] scheduled stop
- [x] scheduled stop
- [x] add stop method to program
- [x] actually stop the program at the stop time
- [x] go through _stopping_ state
@@ -53,8 +53,6 @@
- [x] add stop time to run view
- [x] docs
- [x] refactor `apsis.stop` module
- [ ] update `_process_updates` to set the state for a stopping job
- clarify the rules for `run_state` updates
- [ ] if `send_signal` raises, error the run

- [ ] improve `apsis job` output style
10 changes: 10 additions & 0 deletions python/apsis/apsis.py
Original file line number Diff line number Diff line change
@@ -597,6 +597,16 @@ async def rerun(self, run, *, time=None):


async def stop_run(self, run):
"""
Transitions `run` to stopping, and requests its program to stop in a
new task.

The `run` must be either running, or else stopping in which case
this is a no-op.

Adds `{"stopping": True}` to the run's run state when it transitions to
stopping.
"""
if run.state == State.stopping:
log.info(f"run already stopping: {run.run_id}")
return
Loading