-
Notifications
You must be signed in to change notification settings - Fork 93
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
Refactor task killing & simplify task state deltas #6457
base: master
Are you sure you want to change the base?
Conversation
|
||
Returns number of tasks that could not be killed. | ||
""" | ||
jobless = self.get_run_mode() == RunMode.SIMULATION |
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.
(Need to follow-up with skip mode #6039)
@@ -8,13 +8,13 @@ | |||
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">̿● a </span> | |||
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">-</span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">̿⊗ Y </span> | |||
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">̿⊗ b </span> | |||
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">-</span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">̿⊘ 2 </span> | |||
<span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">-</span><span style="color:#000000;background:#e5e5e5"> </span><span style="color:#000000;background:#e5e5e5">̎⊘ 2 </span> |
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.
The reason for the change in icon is that previously, the held state was not updated in the data store by the test fixture:
cylc-flow/tests/integration/tui/test_app.py
Lines 34 to 44 in 478b0d0
def set_task_state(schd, task_states): | |
"""Force tasks into the desired states. | |
Task states should be of the format (cycle, task, state, is_held). | |
""" | |
for cycle, task, state, is_held in task_states: | |
itask = schd.pool.get_task(cycle, task) | |
if not itask: | |
itask = schd.pool.spawn_task(task, cycle, {1}) | |
itask.state_reset(state, is_held=is_held) | |
schd.data_store_mgr.delta_task_state(itask) |
@@ -1322,7 +1322,6 @@ def _process_message_failed(self, itask, event_time, message, forced): | |||
no_retries = True | |||
if itask.state_reset(TASK_STATUS_FAILED, forced=forced): | |||
self.setup_event_handlers(itask, self.EVENT_FAILED, message) | |||
self.data_store_mgr.delta_task_state(itask) |
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.
Duplicate of L1328 just below
cylc/flow/data_store_mgr.py
Outdated
tp_id, PbTaskProxy(id=tp_id)) | ||
tp_delta.stamp = f'{tp_id}@{update_time}' | ||
tp_delta.state = itask.state.status | ||
tp_delta.is_held = itask.state.is_held |
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.
Currently:
attr | updater |
---|---|
status | delta_task_state |
is_held | delta_task_held |
is_queued | delta_task_queued |
is_runahead | delta_task_runahead |
I'm not sure why we would move is_held
in with delta_task_state
? Unless we wanted to move all the attrs into delta_task_state
?
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.
To me it looks like it makes sense to move all into delta_task_state
? These are all handled by 1 method on TaskProxy
, so it would reduce chances of forgetting to update them all in the data store. And it would be more efficient in the data store to do all at once
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.
We could do it all in one, but I think it would be less (not more) efficient for the data store to do this all at once as we would be pushing out all four attributes every time any one of them changes.
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.
If that's a concern, could do
if tproxy.is_held != itask.state.is_held:
tp_delta.is_held = itask.state.is_held
etc.
Or drop the commit as I've separated it out into its own commit now.
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.
Sounds good. I think, either we leave as is, or we combine all the related attrs and compare to previous value as you suggested.
status=(TASK_STATUS_FAILED if jobless else None), | ||
is_held=True, | ||
) | ||
self.data_store_mgr.delta_task_state(itask) |
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.
self.data_store_mgr.delta_task_state(itask) | |
self.data_store_mgr.delta_task_state(itask) | |
self.data_store_mgr.delta_task_held(itask) |
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.
Not needed if we include itask.is_held
in delta_task_state()
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.
Approval conditional on your option of doing this:
if tproxy.is_held != itask.state.is_held:
tp_delta.is_held = itask.state.is_held
And you'd want to do the same with queue and runahead ..etc
Also check/do nothing if nothing has changed (unless that's impossible upstream)..
It's only if a field is set that it will be sent as a delta, so if we can avoid sending a field, that's ideal.
@dwsutherland I noticed that if you inspect |
In preparation for tackling the last piece of the
cylc remove
proposal:I extracted and de-deduped the kill mechanism into a scheduler method.
Also, it seems to me the data store manager's
delta_task_state()
method should includeis_held
,is_queued
andis_runahead
.Check List
CONTRIBUTING.md
and added my name as a Code Contributor.?.?.x
branch.