-
Notifications
You must be signed in to change notification settings - Fork 94
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
Platforms.eval platform cmd #3791
Conversation
98927a3
to
4c187ad
Compare
# Check that platform upgrader will fail if, after inheritance but not | ||
# before a task has both old and new settings - This should be a fail on | ||
# Job Submit. | ||
# Parent and child tasks are both valid, before inheritance calculated. |
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.
Unrelated, but not worth a full, separate PR.
03e7abe
to
78f5559
Compare
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.
Looks fine, testing to follow.
One legitimate test failure - tests/f/job-submission/18-platform_select.t
bf13226
to
87436b9
Compare
My fault - Dave suggested that I was raising the wrong error, so I changed the error I raised... |
7880997
to
d1082d2
Compare
One test failing - fixed by #3806? |
Update cylc/flow/platforms.py Co-authored-by: Oliver Sanders <oliver.sanders@metoffice.gov.uk> fix broken test testfix
d1082d2
to
a015191
Compare
Looks very much like it. 👍🏼 Can I request re-review from @oliver-sanders and @hjoliver |
Closes #3672? |
Looks good, testing I spotted some unexpected behaviour: A non existent platform will result in a platform = $(echo 'elephant')
There seems to be some unintended pattern matching going on, for instance platform = $(echo 'localhost-xyz-mess')
|
_ = rtconfig[itask.tdef.run_mode + ' mode']['disable retries'] | ||
except KeyError: | ||
retry = True | ||
if ( |
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.
This should be faster since in most cases the try was going to fail.
I think I've fixed this in commit 3175fee
I think I have fixed this in commit e6838a6 |
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.
Getting a submit failure now for platform=$(echo elephant)
👍. Sadly also getting this (harmless) traceback:
2020-09-15T15:55:08+01:00 ERROR - [Errno 2] No such file or directory:
'/Users/oliver/cylc-run/foo/log/job/1/foo/01/job-activity.log'
Traceback (most recent call last):
File "/Users/oliver/cylc-flow/cylc/flow/task_job_mgr.py", line 865, in
_prep_submit_task_job
platform = get_platform(rtconfig)
File "/Users/oliver/cylc-flow/cylc/flow/platforms.py", line 82, in get_platform
output = platform_from_name(task_conf['platform'])
File "/Users/oliver/cylc-flow/cylc/flow/platforms.py", line 184, in
platform_from_name
f"No matching platform \"{platform_name}\" found")
cylc.flow.exceptions.PlatformLookupError: No matching platform "elephant" found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/oliver/cylc-flow/cylc/flow/task_events_mgr.py", line 87, in
log_task_job_activity
with open(os.path.expandvars(job_activity_log), "ab") as handle:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/oliver/cylc-
run/foo/log/job/1/foo/01/job-activity.log'
I think the old logic may have created the job activity log on failure to avoid this?
Yes, @oliver-sanders pointed out that at some point I had deleted the line self._create_job_log_path(suite, itask) in task_job_mgr which is required to create the job-activity.log |
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.
All good I think.
The log messages contain a bit of duplicated info and could do with being tidied up a bit:
DEBUG - ['bash', '-c', 'echo
localhost']
DEBUG - [remote-host-select cmd] bash -c
'echo localhost'
[remote-host-select ret_code] 0
[remote-host-select out] localhost
DEBUG - for task foo.1: platform =
$(echo localhost) evaluated as localhost
One message should suffice for this case, note the second log message comes from the subprocpool and contains all the required info.
DEBUG - Traceback (most recent call
last):
File "/Users/oliver/cylc-flow/cylc/flow/task_job_mgr.py", line 866, in
_prep_submit_task_job
platform = get_platform(rtconfig)
File "/Users/oliver/cylc-flow/cylc/flow/platforms.py", line 82, in get_platform
output = platform_from_name(task_conf['platform'])
File "/Users/oliver/cylc-flow/cylc/flow/platforms.py", line 184, in
platform_from_name
f"No matching platform \"{platform_name}\" found")
cylc.flow.exceptions.PlatformLookupError: No matching platform "elephant" found
ERROR - No matching platform "elephant" found
ERROR - [jobs-submit cmd] (platform not defined)
[jobs-submit ret_code] 1
[jobs-submit err] No matching platform "elephant" found
One message should suffice for this case, the traceback isn't helpful here as we already know where the exception was raised from.
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.
Looks good, thanks @wxtim 👍
@wxtim - can you address the log duplication as a follow-up? |
main response to #3672
Synopsis
As per the deprecation examples in the platforms proposal Cylc 8 is to be able to evaluate either:
[TASK]platform = $(some-shell-script.sh)
[TASK][remote]host = $(some-shell-script.sh)
In a similar way at job submission time.
This PR attempts to create this behavior.
Work undertaken
platform = name
andhost = name
.remote_host_select
.Follow on work not undertaken
remote_host_select
- should be straightforward, but would confuse the issue.