When one tries to schedule a not registered task using swh-scheduler CLI, the following traceback is displayed in command output:
14:51 $ doco exec swh-scheduler swh scheduler task add -p oneshot list-foo Traceback (most recent call last): File "/srv/softwareheritage/venv/bin/swh", line 8, in <module> sys.exit(main()) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/core/cli/__init__.py", line 184, in main return swh(auto_envvar_prefix="SWH") File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/scheduler/cli/task.py", line 284, in schedule_task created = scheduler.create_tasks([task]) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/core/db/common.py", line 73, in _meth return meth(self, *args, db=db, cur=cur, **kwargs) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/scheduler/backend.py", line 605, in create_tasks cur.execute(query) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/psycopg2/extras.py", line 251, in execute return super(RealDictCursor, self).execute(query, vars) psycopg2.errors.NotNullViolation: null value in column "retries_left" violates not-null constraint DETAIL: Failing row contains (1, list-foo, {"args": [], "kwargs": {}}, 2022-09-14 12:52:05.061432+00, null, next_run_not_scheduled, oneshot, null, null). CONTEXT: SQL statement "insert into task (type, arguments, next_run, status, current_interval, policy, retries_left, priority) select type, arguments, next_run, status, current_interval, policy, retries_left, priority from tmp_task t where not exists(select 1 from task where type = t.type and md5(arguments::text) = md5(t.arguments::text) and arguments = t.arguments and policy = t.policy and priority is not distinct from t.priority and status = t.status)" PL/pgSQL function swh_scheduler_create_tasks_from_temp() line 12 at SQL statement
As this is not really user friendly, an error message should be displayed instead, something like
Error: no celery task named <task_name> is registered in swh-scheduler database.