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

Pass pre-install plugins the value of workflow rundir #6404

Open
wants to merge 1 commit into
base: 8.3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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/6404.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use opts.against_source to pass rundir to plugins
6 changes: 6 additions & 0 deletions cylc/flow/scripts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import asyncio

import os.path
from pathlib import Path
from typing import List, Optional, TYPE_CHECKING

from cylc.flow.cfgspec.glbl_cfg import glbl_cfg
Expand Down Expand Up @@ -202,6 +203,11 @@
print("\n".join(get_config_file_hierarchy(workflow_id)))
return

# Save the location of the existing workflow run dir in the
# against source option:
if options.against_source:
options.against_source = Path(get_workflow_run_dir(workflow_id))

Check warning on line 209 in cylc/flow/scripts/config.py

View check run for this annotation

Codecov / codecov/patch

cylc/flow/scripts/config.py#L209

Added line #L209 was not covered by tests

config = WorkflowConfig(
workflow_id,
flow_file,
Expand Down
7 changes: 7 additions & 0 deletions cylc/flow/scripts/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import asyncio
from difflib import unified_diff
from pathlib import Path
from shutil import which
from subprocess import Popen, PIPE
import sys
Expand All @@ -53,6 +54,7 @@
CylcOptionParser as COP,
icp_option,
)
from cylc.flow.pathutil import get_workflow_run_dir
from cylc.flow.templatevars import get_template_vars
from cylc.flow.terminal import cli_function

Expand Down Expand Up @@ -558,6 +560,11 @@
constraint='workflows',
)

# Save the location of the existing workflow run dir in the
# against source option:
if opts.against_source:
opts.against_source = Path(get_workflow_run_dir(workflow_id))

Check warning on line 566 in cylc/flow/scripts/graph.py

View check run for this annotation

Codecov / codecov/patch

cylc/flow/scripts/graph.py#L566

Added line #L566 was not covered by tests

if opts.diff:
return await graph_diff(
opts, workflow_id, opts.diff, start, stop, flow_file)
Expand Down
8 changes: 8 additions & 0 deletions cylc/flow/scripts/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import asyncio
import os
from pathlib import Path
import sys
from typing import TYPE_CHECKING

Expand All @@ -43,6 +44,7 @@
CylcOptionParser as COP,
icp_option,
)
from cylc.flow.workflow_files import get_workflow_run_dir
from cylc.flow.templatevars import get_template_vars
from cylc.flow.terminal import cli_function

Expand Down Expand Up @@ -151,6 +153,12 @@
[options.all_tasks, options.all_namespaces, options.mro]):
print("WARNING: -t chosen, ignoring non-tree options.",
file=sys.stderr)

# Save the location of the existing workflow run dir in the
# against source option:
if options.against_source:
options.against_source = Path(get_workflow_run_dir(workflow_id))

Check warning on line 160 in cylc/flow/scripts/list.py

View check run for this annotation

Codecov / codecov/patch

cylc/flow/scripts/list.py#L160

Added line #L160 was not covered by tests

config = WorkflowConfig(
workflow_id,
flow_file,
Expand Down
8 changes: 8 additions & 0 deletions cylc/flow/scripts/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import asyncio
from ansimarkup import parse as cparse
from copy import deepcopy
from pathlib import Path
import sys
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -55,6 +56,7 @@
from cylc.flow.templatevars import get_template_vars
from cylc.flow.terminal import cli_function
from cylc.flow.scheduler_cli import RUN_MODE
from cylc.flow.workflow_files import get_workflow_run_dir
from cylc.flow.workflow_status import RunMode

if TYPE_CHECKING:
Expand Down Expand Up @@ -153,6 +155,12 @@ async def run(
src=True,
constraint='workflows',
)

# Save the location of the existing workflow run dir in the
# against source option:
if getattr(options, 'against_source', False):
options.against_source = Path(get_workflow_run_dir(workflow_id))

cfg = WorkflowConfig(
workflow_id,
flow_file,
Expand Down
11 changes: 8 additions & 3 deletions cylc/flow/scripts/validate_reinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"""

import asyncio
from pathlib import Path
import sys
from typing import TYPE_CHECKING, Union

Expand Down Expand Up @@ -75,7 +76,10 @@
run as cylc_reload
)
from cylc.flow.terminal import cli_function
from cylc.flow.workflow_files import detect_old_contact_file
from cylc.flow.workflow_files import (
detect_old_contact_file,
get_workflow_run_dir,
)

CYLC_ROSE_OPTIONS = COP.get_cylc_rose_options()
VR_OPTIONS = combine_options(
Expand Down Expand Up @@ -186,8 +190,9 @@ async def vr_cli(
):
return False

# Force on the against_source option:
options.against_source = True
# Save the location of the existing workflow run dir in the
# against source option:
options.against_source = Path(get_workflow_run_dir(workflow_id))

# Run cylc validate
log_subcommand('validate --against-source', workflow_id)
Expand Down
8 changes: 8 additions & 0 deletions cylc/flow/scripts/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"""

import asyncio
from pathlib import Path
from typing import TYPE_CHECKING

from cylc.flow.id_cli import parse_id_async
Expand All @@ -42,6 +43,7 @@
WORKFLOW_ID_OR_PATH_ARG_DOC,
CylcOptionParser as COP,
)
from cylc.flow.pathutil import get_workflow_run_dir
from cylc.flow.parsec.fileparse import read_and_proc
from cylc.flow.templatevars import get_template_vars
from cylc.flow.terminal import cli_function
Expand Down Expand Up @@ -122,6 +124,12 @@
src=True,
constraint='workflows',
)

# Save the location of the existing workflow run dir in the
# against source option:
if options.against_source:
options.against_source = Path(get_workflow_run_dir(workflow_id))

Check warning on line 131 in cylc/flow/scripts/view.py

View check run for this annotation

Codecov / codecov/patch

cylc/flow/scripts/view.py#L131

Added line #L131 was not covered by tests

# read in the flow.cylc file
for line in read_and_proc(
flow_file,
Expand Down
Loading