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

Lint: Only warn about -W when used for LSF #6551

Open
wants to merge 3 commits into
base: 8.4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes.d/6551.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Lint: Fix bug where lint warned about use of legitimate -W directive for PBS.
18 changes: 15 additions & 3 deletions cylc/flow/scripts/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,12 @@ def get_wallclock_directives():
'TIME_LIMIT_DIRECTIVE',
None
)
if directive:
directives[module.name] = directive
if directive and directive == '-W':
# LSF directive -W needs to have a particular form to
# avoid matching PBS directive -W:
directives[module.name] = re.compile(r'^-W\s+(\d+:)?\d+$')
elif directive:
directives[module.name] = re.compile(rf'^{directive}')
return directives


Expand All @@ -209,9 +213,17 @@ def check_wallclock_directives(line: str) -> Union[Dict[str, str], bool]:
>>> this = check_wallclock_directives
>>> this(' -W 42:22')
{'directive': '-W 42:22'}
>>> this(' -W 42:22/hostname') # Legit LSF use case
Copy link
Member Author

Choose a reason for hiding this comment

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

Looking at https://www.ibm.com/docs/en/spectrum-lsf/10.1.0?topic=o-w-1, I think that this is an LSF wallclock directive which can't be handled by execution time limit and therefore is a legitimate case for using -W with LSF.

Copy link
Member

Choose a reason for hiding this comment

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

Can you do multiple things with this opt?

e.g -W 00:02 foo=bar

Copy link
Member Author

Choose a reason for hiding this comment

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

In LSF or PBS?

In LSF, not really.

In PBS, not really - only key=value pairs.

I don't think that the two are mistakeable.

False
>>> this(' -W 422')
{'directive': '-W 422'}
>>> this(' -W foo=42') # Legit PBS use case.
False
>>> this(' -W foo="Hello World"') # Legit PBS use case.
False
"""
for directive in set(WALLCLOCK_DIRECTIVES.values()):
if line.strip().startswith(directive):
if directive.findall(line.strip()):
return {'directive': line.strip()}
return False

Expand Down
Loading