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

Restore default for PBS max job name len. #5386

Merged
merged 7 commits into from
Mar 8, 2023

Conversation

wxtim
Copy link
Member

@wxtim wxtim commented Mar 1, 2023

This is a pull request describing the issue to be fixed.

Issue

If global.cylc[platforms][<platform>]job name length maximum is unset cylc.flow.job_runner_handlers.pbs.PBSHandler.format_directives will fail with a key error.

Instead it should fall back to the value contained in JOB_NAME_LEN_MAX.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • CHANGES.md entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@wxtim wxtim added this to the cylc-8.1.3 milestone Mar 1, 2023
@wxtim wxtim self-assigned this Mar 1, 2023
@wxtim wxtim force-pushed the fix.pbs_job_len_truncation branch from e00c962 to 7b300b4 Compare March 1, 2023 15:54
@wxtim wxtim added the bug Something is wrong :( label Mar 1, 2023
Comment on lines +99 to +102
job_name_len_max = job_conf['platform'].get(
"job name length maximum",
self.JOB_NAME_LEN_MAX
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking back, this wasn't working around the problem with OrderedDictWithDefaults not working right with .get was it?

Copy link
Member

@MetRonnie MetRonnie Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a revert of f12a089. Would like to know why that commit did it this way in the first place. (Edit: only a partial revert actually)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't any information on that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't remember that problem. :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Judging from my description of the OrderedDictWithDefaults.get() problem here: #4975 (comment), I think this is fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can someone test this out with and without config defaults, for localhost and something-else, just to be safe.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can someone test this out with and without config defaults, for localhost and something-else, just to be safe.

How do I test it out with localhost - it needs a pbs platform?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can take the platform.get code snippet out and put it anywhere you like, no need to test in-situ.

Copy link
Member

@oliver-sanders oliver-sanders Mar 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ cylc config -i '[platforms][localhost]'
ssh command = ssh -oBatchMode=yes -oConnectTimeout=8 -oStrictHostKeyChecking=no
copyable environment variables = FCM_VERSION
submission polling intervals = PT1H
execution polling intervals = PT1H
clean job submission environment = True
diff --git a/cylc/flow/cfgspec/globalcfg.py b/cylc/flow/cfgspec/globalcfg.py
index 17ca5d98d..dbf2baed1 100644
--- a/cylc/flow/cfgspec/globalcfg.py
+++ b/cylc/flow/cfgspec/globalcfg.py
@@ -1891,6 +1891,8 @@ class GlobalConfig(ParsecConfig):
         # Flesh out with defaults
         self.expand()
 
+        breakpoint()
+
         self._no_platform_group_name_overlap()
         with suppress(KeyError):
             validate_platforms(self.sparse['platforms'])
(Pdb) self.get(['platforms', 'localhost']).get('job runner')  # default
'background'
(Pdb) self.get(['platforms', 'localhost']).get('execution polling intervals')  # manually specified
[3600.0]

.get appears to work fine for both, just needed to confirm that especially as we know there's strange behaviour with these objects.

CHANGES.md Show resolved Hide resolved
Comment on lines +99 to +102
job_name_len_max = job_conf['platform'].get(
"job name length maximum",
self.JOB_NAME_LEN_MAX
)
Copy link
Member

@MetRonnie MetRonnie Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a revert of f12a089. Would like to know why that commit did it this way in the first place. (Edit: only a partial revert actually)

CHANGES.md Outdated Show resolved Hide resolved
Comment on lines +99 to +102
job_name_len_max = job_conf['platform'].get(
"job name length maximum",
self.JOB_NAME_LEN_MAX
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Judging from my description of the OrderedDictWithDefaults.get() problem here: #4975 (comment), I think this is fine.

wxtim and others added 5 commits March 2, 2023 14:57
This needs to be used if it is not set in the site config and
was mistakenly removed.
Co-authored-by: Oliver Sanders <oliver.sanders@metoffice.gov.uk>
@wxtim wxtim force-pushed the fix.pbs_job_len_truncation branch from 0d1c169 to 3399adb Compare March 2, 2023 14:58
@wxtim wxtim requested a review from MetRonnie March 2, 2023 14:59
tests/unit/job_runner_handlers/test_pbs.py Outdated Show resolved Hide resolved
wxtim and others added 2 commits March 2, 2023 15:35
Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
@oliver-sanders oliver-sanders merged commit a92efae into cylc:8.1.x Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :(
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants