forked from wongwill86/air-tasks
-
Notifications
You must be signed in to change notification settings - Fork 2
Skip ramp_up/ramp_down during batch processing #115
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
Open
nkemnitz
wants to merge
2
commits into
seung-lab:main
Choose a base branch
from
ZettaAI:nkem/batch-keep-cluster
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -207,53 +207,62 @@ def handle_batch(task, msg): | |
| replyto(msg, "Batch jobs will reuse on the parameters from the first job unless new parameters are specified, *including those with default values*") | ||
|
|
||
| default_param = json_obj[0] | ||
| for i, p in enumerate(json_obj): | ||
| if visible_messages(broker_url, "seuronbot_cmd") != 0: | ||
| cmd = get_message(broker_url, "seuronbot_cmd") | ||
| if cmd == "cancel": | ||
| replyto(msg, "Cancel batch process") | ||
| break | ||
|
|
||
| if p.get("INHERIT_PARAMETERS", True): | ||
| param = deepcopy(default_param) | ||
| else: | ||
| param = {} | ||
|
|
||
| if i > 0: | ||
| if 'NAME' in param: | ||
| del param['NAME'] | ||
| for k in p: | ||
| param[k] = p[k] | ||
| supply_default_param(param) | ||
| replyto(msg, "*Sanity check: batch job {} out of {}*".format(i+1, len(json_obj))) | ||
| is_batch = len(json_obj) > 1 | ||
| try: | ||
| for i, p in enumerate(json_obj): | ||
| if visible_messages(broker_url, "seuronbot_cmd") != 0: | ||
| cmd = get_message(broker_url, "seuronbot_cmd") | ||
| if cmd == "cancel": | ||
| replyto(msg, "Cancel batch process") | ||
| break | ||
|
|
||
| if p.get("INHERIT_PARAMETERS", True): | ||
| param = deepcopy(default_param) | ||
| else: | ||
| param = {} | ||
|
|
||
| if i > 0: | ||
| if 'NAME' in param: | ||
| del param['NAME'] | ||
| for k in p: | ||
| param[k] = p[k] | ||
| supply_default_param(param) | ||
| replyto(msg, "*Sanity check: batch job {} out of {}*".format(i+1, len(json_obj))) | ||
| state = "unknown" | ||
| current_task = guess_run_type(param) | ||
| if current_task == "seg_run": | ||
| set_variable('param', param, serialize_json=True) | ||
| state = run_dag("sanity_check", wait_for_completion=True).state | ||
| elif current_task == "inf_run": | ||
| set_variable('inference_param', param, serialize_json=True) | ||
| state = run_dag("chunkflow_generator", wait_for_completion=True).state | ||
| elif current_task == "syn_run": | ||
| set_variable("synaptor_param.json", param, serialize_json=True) | ||
| state = run_dag("synaptor_sanity_check", wait_for_completion=True).state | ||
|
|
||
| if state != "success": | ||
| replyto(msg, "*Sanity check failed, abort!*") | ||
| break | ||
|
|
||
| is_last_job = (i == len(json_obj) - 1) | ||
| state = "unknown" | ||
| current_task = guess_run_type(param) | ||
| replyto(msg, "*Starting batch job {} out of {}*".format(i+1, len(json_obj)), broadcast=True) | ||
|
|
||
| if current_task == "seg_run": | ||
| set_variable('param', param, serialize_json=True) | ||
| state = run_dag("sanity_check", wait_for_completion=True).state | ||
| state = run_dag('segmentation', wait_for_completion=True).state | ||
| elif current_task == "inf_run": | ||
| set_variable('inference_param', param, serialize_json=True) | ||
| state = run_dag("chunkflow_generator", wait_for_completion=True).state | ||
| if is_batch and not is_last_job: | ||
| set_variable("batch_keep_cluster", "true") | ||
| else: | ||
| set_variable("batch_keep_cluster", "false") | ||
| state = run_dag("chunkflow_worker", wait_for_completion=True).state | ||
|
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.
🟢 Typo: "Bach" should be "Batch".
```suggestion
replyto(msg, f"*Batch job failed, abort!* ({state})")
```
|
||
| elif current_task == "syn_run": | ||
| set_variable("synaptor_param.json", param, serialize_json=True) | ||
| state = run_dag("synaptor_sanity_check", wait_for_completion=True).state | ||
| state = run_dag("synaptor", wait_for_completion=True).state | ||
|
|
||
| if state != "success": | ||
| replyto(msg, "*Sanity check failed, abort!*") | ||
| replyto(msg, f"*Bach job failed, abort!* ({state})") | ||
| break | ||
|
|
||
| state = "unknown" | ||
| replyto(msg, "*Starting batch job {} out of {}*".format(i+1, len(json_obj)), broadcast=True) | ||
|
|
||
| if current_task == "seg_run": | ||
| state = run_dag('segmentation', wait_for_completion=True).state | ||
| elif current_task == "inf_run": | ||
| state = run_dag("chunkflow_worker", wait_for_completion=True).state | ||
| elif current_task == "syn_run": | ||
| state = run_dag("synaptor", wait_for_completion=True).state | ||
|
|
||
| if state != "success": | ||
| replyto(msg, f"*Bach job failed, abort!* ({state})") | ||
| break | ||
| finally: | ||
| set_variable("batch_keep_cluster", "false") | ||
|
|
||
| replyto(msg, "*Batch process finished*") | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 logic for guessing the task type and running the sanity check should be executed for all batch jobs.
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.
No.
current_taskstill gets initialized on line 194. andguess_run_type(param)was also called inside theif i > 0block on the main branch (line 230)...