Skip to content

Commit

Permalink
-W should only be highlighted by Cylc lint when being used in
Browse files Browse the repository at this point in the history
a way which indicates use of LSF.
  • Loading branch information
wxtim committed Jan 10, 2025
1 parent ab87e15 commit 575053f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 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,11 @@ 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 foo=42')
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

0 comments on commit 575053f

Please sign in to comment.