-
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
commands: traceback when specifying jobs #6125
Comments
Note, this is longstanding (not introduced in 8.3.0) and not yet reported so not a release blocker. |
Esp since the traceback doesn't take the scheduler down! |
Suggest tokenising IDs at queue time, then filtering them according to the accepted type(s) for the command. E.G. something along the lines of this: diff --git a/cylc/flow/commands.py b/cylc/flow/commands.py
index 28de0d16e..37c99367f 100644
--- a/cylc/flow/commands.py
+++ b/cylc/flow/commands.py
@@ -71,9 +71,11 @@ from cylc.flow.exceptions import (
CommandFailedError,
CyclingError,
CylcConfigError,
+ InputError,
)
import cylc.flow.flags
from cylc.flow.log_level import log_level_to_verbosity
+from cylc.flow.id import tokenise_ids
from cylc.flow.network.schema import WorkflowStopMode
from cylc.flow.parsec.exceptions import ParsecError
from cylc.flow.task_id import TaskID
@@ -214,8 +216,14 @@ async def stop(
@_command('release')
async def release(schd: 'Scheduler', tasks: Iterable[str]):
"""Release held tasks."""
+ tokens_list, bad_ids = tokenise_ids(*tasks)
+ if bad_ids:
+ raise InputError(
+ 'Invalid IDs provided:'
+ '\n*'.join(f'{id_} - {reason}' for id_, reason in bad_ids)
+ )
yield
- yield schd.pool.release_held_tasks(tasks)
+ yield schd.pool.release_held_tasks(tokens_list)
@_command('release_hold_point')
diff --git a/cylc/flow/id.py b/cylc/flow/id.py
index cba3c4833..83f2a3d3e 100644
--- a/cylc/flow/id.py
+++ b/cylc/flow/id.py
@@ -888,3 +888,23 @@ def contains_multiple_workflows(tokens_list: List[Tokens]) -> bool:
(tokens['user'], tokens['workflow'])
for tokens in tokens_list
}) > 1
+
+
+def tokenise_ids(
+ *ids: str, cylc_type=IDTokens.Task
+) -> Tuple[List[Tokens], List[Tuple[str, str]]]:
+ good = []
+ bad = []
+ for id_ in ids:
+ tokens = Tokens(id_)
+ if tokens.lowest_token == cylc_type:
+ good.append(tokens)
+ else:
+ bad.append(
+ (
+ id_,
+ f'Expected "{cylc_type.value}"'
+ 'got "{tokens.lowest_token.value}"',
+ )
+ )
+ return good, bad However, this will require some bodging in the Until then, we can just make the message nicer (but it won't get reported back to the user, only written in the log). |
Scheduler log traceback appears when jobs are provided as task arguments, e.g:
OP:
Running against any old workflow:
cylc <workflow>//2397/bar/NN/
(got by pressing tab and letting the autocomplete go to it).Gives the
command queued
output in the dispatching terminal, but the following in the log:Originally posted by @wxtim in #6112 (comment)
Similarly
cylc hold --after 239413 <workflow>
is accepted but later causes traceback.The text was updated successfully, but these errors were encountered: