-
Notifications
You must be signed in to change notification settings - Fork 95
polling: reset bad hosts on manual poll #7055
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
base: 8.6.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -223,7 +223,10 @@ def kill_prep_task(self, itask: 'TaskProxy') -> None: | |
| self._prep_submit_task_job_error(itask, '(killed in job prep)', '') | ||
|
|
||
| def poll_task_jobs( | ||
| self, itasks: 'Iterable[TaskProxy]', msg: str | None = None | ||
| self, | ||
| itasks: 'Iterable[TaskProxy]', | ||
| msg: str | None = None, | ||
| manual_request: bool = False, | ||
| ): | ||
| """Poll jobs of specified tasks. | ||
|
|
||
|
|
@@ -245,7 +248,8 @@ def poll_task_jobs( | |
| if itask.state.status != TASK_STATUS_WAITING | ||
| ], | ||
| self._poll_task_jobs_callback, | ||
| self._poll_task_jobs_callback_255 | ||
| self._poll_task_jobs_callback_255, | ||
| continue_if_no_good_hosts=manual_request, | ||
| ) | ||
|
|
||
| def prep_submit_task_jobs( | ||
|
|
@@ -918,13 +922,34 @@ def _poll_task_job_message_callback(self, itask, cmd_ctx, line): | |
| log_task_job_activity(ctx, self.workflow, itask.point, itask.tdef.name) | ||
|
|
||
| def _run_job_cmd( | ||
| self, cmd_key, itasks, callback, callback_255 | ||
| self, | ||
| cmd_key, | ||
| itasks, | ||
| callback, | ||
| callback_255, | ||
| continue_if_no_good_hosts=False, | ||
| ): | ||
| """Run job commands, e.g. poll, kill, etc. | ||
|
|
||
| Group itasks with their platform_name and host. | ||
| Put a job command for each group to the multiprocess pool. | ||
|
|
||
| Args: | ||
| cmd_key: | ||
| Identifier for the command to run. | ||
| itasks: | ||
| List of task proxies to run the command against. | ||
| callback: | ||
| Callback to run on command completion. | ||
| callback_255: | ||
| Callback to run on SSH error. | ||
| continue_if_no_good_hosts: | ||
| If True, the bad hosts set will be reset in the event that | ||
| there are no "good hosts" to run the command on. This should | ||
| only be turned on for manual operations, e.g. manual poll. Use | ||
| of this option for automatic commands may result in feedback | ||
| loops between parallel opererations. | ||
|
|
||
| """ | ||
| if not itasks: | ||
| return | ||
|
|
@@ -968,15 +993,22 @@ def _run_job_cmd( | |
| host = get_host_from_platform( | ||
| platform, bad_hosts=self.bad_hosts | ||
| ) | ||
| cmd = construct_ssh_cmd( | ||
| cmd, platform, host | ||
| ) | ||
| except NoHostsError: | ||
| ctx.err = f'No available hosts for {platform["name"]}' | ||
| LOG.debug(ctx) | ||
| callback_255(ctx, itasks) | ||
| continue | ||
| if continue_if_no_good_hosts: | ||
| # no hosts available for this platform | ||
| # -> reset the bad hosts and try again | ||
| self.task_events_mgr.reset_bad_hosts() | ||
| host = get_host_from_platform( | ||
| platform, bad_hosts=self.bad_hosts | ||
| ) | ||
| else: | ||
| ctx.err = f'No available hosts for {platform["name"]}' | ||
| LOG.debug(ctx) | ||
| callback_255(ctx, itasks) | ||
| continue | ||
|
Comment on lines
+997
to
+1008
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both branches here continue to the next iteration of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mildly concerned that if Ronnie is right (I think he is) that the test isn't failing.... |
||
| else: | ||
|
|
||
| cmd = construct_ssh_cmd(cmd, platform, host) | ||
| ctx = SubProcContext(cmd_key, cmd, host=host) | ||
|
|
||
| for itask in sorted(itasks, key=lambda task: task.identity): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.