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

workflow_state xtrigger and CLI command do not work across users #6030

Closed
ColemanTom opened this issue Mar 21, 2024 · 3 comments · Fixed by #6031
Closed

workflow_state xtrigger and CLI command do not work across users #6030

ColemanTom opened this issue Mar 21, 2024 · 3 comments · Fixed by #6031
Assignees
Labels
bug Something is wrong :(
Milestone

Comments

@ColemanTom
Copy link
Contributor

Description

>>> import workflow_state
>>> from workflow_state import workflow_state as ws
>>> ws('a', 'b', '20240101T1200Z', cylc_run_dir='/home/another_user')
Traceback (most recent call last):
  File "/home/user/miniconda3/envs/cylc-dev/lib/python3.11/site-packages/cylc/flow/workflow_files.py", line 872, in infer_latest_run
    id_ = str(path.relative_to(cylc_run_dir))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/cylc-dev/lib/python3.11/pathlib.py", line 730, in relative_to
    raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '/home/another_user/a' is not in the subpath of '/home/548/tc2375/cylc-run' OR one path is relative and the other is absolute.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/548/tc2375/cylc/cylc/flow/xtriggers/workflow_state.py", line 87, in workflow_state
    _, workflow = infer_latest_run(Path(cylc_run_dir, workflow))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/cylc-dev/lib/python3.11/site-packages/cylc/flow/workflow_files.py", line 874, in infer_latest_run
    raise ValueError(f"{path} is not in the cylc-run directory")
ValueError: /home/another_user/a is not in the cylc-run directory



>>> from pathlib import Path
>>> a=Path('/home/tc2375')
>>> a.relative_to('/home/another_user')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/miniconda3/envs/cylc-dev/lib/python3.11/pathlib.py", line 730, in relative_to
    raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '/home/tc2375' is not in the subpath of '/home/another_user' OR one path is relative and the other is absolute.
>>>

Reproducible Example

See above. The relative_to method does not work for across user checking.
You can do similar from the command line interface, but make sure to use the --debug flag otherwise the error message is misleading/unhelpful.

Expected Behaviour

Should be able to use workflow_state across different users.

@ColemanTom ColemanTom added the bug Something is wrong :( label Mar 21, 2024
@hjoliver
Copy link
Member

hjoliver commented Mar 21, 2024

Thanks @ColemanTom I think you're right. We must be lacking a test for this. My last manual test, it seems that it worked because I had a workflow of the same name in my own run-dir.

Looks like some of the new Cylc 8 "workflow_files" code assumes owner-only run-dirs...

@hjoliver hjoliver added this to the cylc-8.3.0 milestone Mar 21, 2024
@hjoliver
Copy link
Member

We'd better fix this for 8.3.0 - it would be a show-stopper for Cylc 8 migration at some sites (mine included).

@hjoliver
Copy link
Member

hjoliver commented Apr 4, 2024

Closed by #6031

@hjoliver hjoliver closed this as completed Apr 4, 2024
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 a pull request may close this issue.

3 participants