From 324883b79c6d71cf19d5aac4becdbe4b6ca528a7 Mon Sep 17 00:00:00 2001 From: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> Date: Wed, 14 Apr 2021 17:32:13 +0100 Subject: [PATCH 1/7] Remove global run/work dir config items - [platforms][X]run directory - [platforms][X]work directory --- cylc/flow/cfgspec/globalcfg.py | 15 --- cylc/flow/cfgspec/suite.py | 3 +- cylc/flow/dbstatecheck.py | 8 +- cylc/flow/job_file.py | 14 +-- cylc/flow/pathutil.py | 55 +++++------ cylc/flow/scripts/cat_log.py | 1 - cylc/flow/scripts/suite_state.py | 31 +++--- cylc/flow/task_events_mgr.py | 2 +- cylc/flow/task_job_mgr.py | 11 +-- cylc/flow/task_remote_mgr.py | 6 +- cylc/flow/xtriggers/suite_state.py | 10 +- .../cyclers/19-async_integer.t | 3 +- .../cylc-get-site-config/04-homeless.t | 13 ++- tests/integration/conftest.py | 13 +-- tests/integration/utils/__init__.py | 15 --- tests/integration/utils/test_utils.py | 8 -- tests/unit/conftest.py | 25 +++++ tests/unit/test_job_file.py | 17 +--- tests/unit/test_pathutil.py | 97 ++++++------------- tests/unit/test_suite_files.py | 32 +----- 20 files changed, 131 insertions(+), 248 deletions(-) diff --git a/cylc/flow/cfgspec/globalcfg.py b/cylc/flow/cfgspec/globalcfg.py index 56e8f7d9a92..8a68cdc50c2 100644 --- a/cylc/flow/cfgspec/globalcfg.py +++ b/cylc/flow/cfgspec/globalcfg.py @@ -423,21 +423,6 @@ ''') Conf('job runner command template', VDR.V_STRING) Conf('shell', VDR.V_STRING, '/bin/bash') - Conf('run directory', VDR.V_STRING, '$HOME/cylc-run', desc=''' - The directory in which to install workflows. - ''') - Conf('work directory', VDR.V_STRING, '$HOME/cylc-run', desc=''' - The top level for suite work and share directories. Can contain - ``$HOME`` or ``$USER`` but not other environment variables (the - item cannot actually be evaluated by the shell on HOST before - use, but the remote home directory is where ``rsync`` and - ``ssh`` naturally land, and the remote username is known by the - suite server program). - - Example:: - - /nfs/data/$USER/cylc-run - ''') Conf('suite definition directory', VDR.V_STRING) Conf('communication method', VDR.V_STRING, 'zmq', options=['zmq', 'poll', 'ssh'], desc=''' diff --git a/cylc/flow/cfgspec/suite.py b/cylc/flow/cfgspec/suite.py index 91b7da87a09..522d2d5cbd9 100644 --- a/cylc/flow/cfgspec/suite.py +++ b/cylc/flow/cfgspec/suite.py @@ -855,8 +855,7 @@ The top level share and work directory location can be changed (e.g. to a large data area) by a global config setting (see - :cylc:conf:`global.cylc - [platforms][]work directory`). + :cylc:conf:`global.cylc[symlink dirs]`). .. note:: diff --git a/cylc/flow/dbstatecheck.py b/cylc/flow/dbstatecheck.py index 342276fda02..c138854bd7a 100644 --- a/cylc/flow/dbstatecheck.py +++ b/cylc/flow/dbstatecheck.py @@ -19,6 +19,8 @@ import os import sqlite3 import sys + +from cylc.flow.pathutil import expand_path from cylc.flow.rundb import CylcSuiteDAO from cylc.flow.task_state import ( TASK_STATUS_SUBMITTED, @@ -55,9 +57,9 @@ class CylcSuiteDBChecker: } def __init__(self, rund, suite): - db_path = os.path.join( - os.path.expanduser(rund), suite, "log", - CylcSuiteDAO.DB_FILE_BASE_NAME) + db_path = expand_path( + rund, suite, "log", CylcSuiteDAO.DB_FILE_BASE_NAME + ) if not os.path.exists(db_path): raise OSError(errno.ENOENT, os.strerror(errno.ENOENT), db_path) self.conn = sqlite3.connect(db_path, timeout=10.0) diff --git a/cylc/flow/job_file.py b/cylc/flow/job_file.py index 56c33f5c98a..b11cee13bd4 100644 --- a/cylc/flow/job_file.py +++ b/cylc/flow/job_file.py @@ -24,9 +24,7 @@ from cylc.flow import __version__ as CYLC_VERSION from cylc.flow.job_runner_mgr import JobRunnerManager import cylc.flow.flags -from cylc.flow.pathutil import ( - get_remote_suite_run_dir, - get_remote_suite_work_dir) +from cylc.flow.pathutil import get_remote_suite_run_dir from cylc.flow.config import interpolate_template, ParamExpandError @@ -56,9 +54,8 @@ def write(self, local_job_file_path, job_conf, check_syntax=True): # Access to cylc must be configured before user environment so # that cylc commands can be used in defining user environment # variables: NEXT_CYCLE=$( cylc cycle-point --offset-hours=6 ) - platform = job_conf['platform'] tmp_name = os.path.expandvars(local_job_file_path + '.tmp') - run_d = get_remote_suite_run_dir(platform, job_conf['suite_name']) + run_d = get_remote_suite_run_dir(job_conf['suite_name']) try: with open(tmp_name, 'w') as handle: self._write_header(handle, job_conf) @@ -201,14 +198,7 @@ def _write_suite_environment(self, handle, job_conf, run_d): handle.write('\n') # override and write task-host-specific suite variables - work_d = get_remote_suite_work_dir( - job_conf["platform"], job_conf['suite_name']) handle.write('\n export CYLC_SUITE_RUN_DIR="%s"' % run_d) - if work_d != run_d: - # Note: not an environment variable, but used by job.sh - handle.write( - '\n export CYLC_SUITE_WORK_DIR_ROOT="%s"' % work_d - ) handle.write( '\n export CYLC_SUITE_UUID="%s"' % job_conf['uuid_str']) diff --git a/cylc/flow/pathutil.py b/cylc/flow/pathutil.py index b7d0477aa87..d3ff67cbed1 100644 --- a/cylc/flow/pathutil.py +++ b/cylc/flow/pathutil.py @@ -24,10 +24,12 @@ from cylc.flow import LOG from cylc.flow.cfgspec.glbl_cfg import glbl_cfg from cylc.flow.exceptions import WorkflowFilesError -from cylc.flow.platforms import ( - get_localhost_install_target, - platform_from_name -) +from cylc.flow.platforms import get_localhost_install_target + + +# Note: do not import this elsewhere, as it might bypass unit test +# monkeypatching: +_CYLC_RUN_DIR = '$HOME/cylc-run' def expand_path(*args: Union[Path, str]) -> str: @@ -37,23 +39,20 @@ def expand_path(*args: Union[Path, str]) -> str: )) -def get_remote_suite_run_dir(platform, suite, *args): - """Return remote suite run directory, join any extra args.""" - return os.path.join( - platform['run directory'], suite, *args) - - -def get_remote_suite_run_job_dir(platform, suite, *args): - """Return remote suite run directory, join any extra args.""" - return get_remote_suite_run_dir( - platform, suite, 'log', 'job', *args) +def get_remote_suite_run_dir( + flow_name: Union[Path, str], *args: Union[Path, str] +) -> str: + """Return remote workflow run directory, joining any extra args, + NOT expanding vars or user.""" + return os.path.join(_CYLC_RUN_DIR, flow_name, *args) -def get_remote_suite_work_dir(platform, suite, *args): - """Return remote suite work directory root, join any extra args.""" - return os.path.join( - platform['work directory'], suite, *args - ) +def get_remote_suite_run_job_dir( + flow_name: Union[Path, str], *args: Union[Path, str] +) -> str: + """Return remote workflow job log directory, joining any extra args, + NOT expanding vars or user.""" + return get_remote_suite_run_dir(flow_name, 'log', 'job', *args) def get_workflow_run_dir( @@ -64,11 +63,7 @@ def get_workflow_run_dir( Does not check that the directory exists. """ - return expand_path( - os.path.join( - platform_from_name()['run directory'], flow_name, *args - ) - ) + return expand_path(_CYLC_RUN_DIR, flow_name, *args) def get_suite_run_job_dir(suite, *args): @@ -103,16 +98,12 @@ def get_suite_run_pub_db_name(suite): def get_suite_run_share_dir(suite, *args): """Return local suite work/share directory, join any extra args.""" - return expand_path(os.path.join( - platform_from_name()['work directory'], suite, 'share', *args - )) + return get_workflow_run_dir(suite, 'share', *args) def get_suite_run_work_dir(suite, *args): """Return local suite work/work directory, join any extra args.""" - return expand_path(os.path.join( - platform_from_name()['work directory'], suite, 'work', *args - )) + return get_workflow_run_dir(suite, 'work', *args) def get_suite_test_log_name(suite): @@ -122,8 +113,6 @@ def get_suite_test_log_name(suite): def make_suite_run_tree(suite): """Create all top-level cylc-run output dirs on the suite host.""" - dir_ = get_workflow_run_dir(suite) - # Create for dir_ in ( get_workflow_run_dir(suite), get_suite_run_log_dir(suite), @@ -156,7 +145,7 @@ def make_localhost_symlinks(rund, named_sub_dir): dst = rund else: dst = os.path.join(rund, key) - src = os.path.expandvars(value) + src = expand_path(value) if '$' in src: raise WorkflowFilesError( f'Unable to create symlink to {src}.' diff --git a/cylc/flow/scripts/cat_log.py b/cylc/flow/scripts/cat_log.py index e7b2e1dffa9..8ee525ebef8 100755 --- a/cylc/flow/scripts/cat_log.py +++ b/cylc/flow/scripts/cat_log.py @@ -423,7 +423,6 @@ def main(parser, options, *args, color=False): and live_job_id is None) if log_is_remote and (not log_is_retrieved or options.force_remote): logpath = os.path.normpath(get_remote_suite_run_job_dir( - platform, suite_name, point, task, options.submit_num, options.filename)) tail_tmpl = platform["tail command template"] # Reinvoke the cat-log command on the remote account. diff --git a/cylc/flow/scripts/suite_state.py b/cylc/flow/scripts/suite_state.py index 9c7e1d9a852..554a137b859 100755 --- a/cylc/flow/scripts/suite_state.py +++ b/cylc/flow/scripts/suite_state.py @@ -62,8 +62,7 @@ from cylc.flow.task_state import TASK_STATUSES_ORDERED from cylc.flow.terminal import cli_function from cylc.flow.cycling.util import add_offset -from cylc.flow.pathutil import expand_path -from cylc.flow.platforms import get_platform +from cylc.flow.pathutil import expand_path, get_workflow_run_dir from metomi.isodatetime.parsers import TimePointParser @@ -169,7 +168,7 @@ def get_option_parser(): parser.add_option( "-S", "--status", help="Specify a particular status or triggering condition to " - "check for. " + conds + states, + f"check for. {conds}{states}", action="store", dest="status", default=None) parser.add_option( @@ -217,20 +216,22 @@ def main(parser, options, suite): if (options.status and options.status not in TASK_STATUSES_ORDERED and options.status not in CylcSuiteDBChecker.STATE_ALIASES): - raise UserInputError("invalid status '" + options.status + "'") + raise UserInputError(f"invalid status '{options.status}'") # this only runs locally - run_dir = expand_path( - options.run_dir or get_platform()['run directory'] - ) - - pollargs = {'suite': suite, - 'run_dir': run_dir, - 'task': options.task, - 'cycle': options.cycle, - 'status': options.status, - 'message': options.msg, - } + if options.run_dir: + run_dir = expand_path(options.run_dir) + else: + run_dir = get_workflow_run_dir('') + + pollargs = { + 'suite': suite, + 'run_dir': run_dir, + 'task': options.task, + 'cycle': options.cycle, + 'status': options.status, + 'message': options.msg, + } spoller = SuitePoller("requested state", options.interval, diff --git a/cylc/flow/task_events_mgr.py b/cylc/flow/task_events_mgr.py index 3e2fe669d44..1976b17c20d 100644 --- a/cylc/flow/task_events_mgr.py +++ b/cylc/flow/task_events_mgr.py @@ -731,7 +731,7 @@ def _process_job_logs_retrieval(self, schd_ctx, ctx, id_keys): # Remote source cmd.append("%s:%s/" % ( get_host_from_platform(platform), - get_remote_suite_run_job_dir(platform, schd_ctx.suite))) + get_remote_suite_run_job_dir(schd_ctx.suite))) # Local target cmd.append(get_suite_run_job_dir(schd_ctx.suite) + "/") self.proc_pool.put_command( diff --git a/cylc/flow/task_job_mgr.py b/cylc/flow/task_job_mgr.py index dd6198ff011..b79cba23fbf 100644 --- a/cylc/flow/task_job_mgr.py +++ b/cylc/flow/task_job_mgr.py @@ -366,11 +366,7 @@ def submit_task_jobs(self, suite, itasks, curve_auth, 'job submission executable paths'] + SYSPATH: cmd.append(f"--path={path}") cmd.append('--') - cmd.append( - get_remote_suite_run_job_dir( - platform, suite - ) - ) + cmd.append(get_remote_suite_run_job_dir(suite)) # Chop itasks into a series of shorter lists if it's very big # to prevent overloading of stdout and stderr pipes. itasks = sorted(itasks, key=lambda itask: itask.identity) @@ -754,7 +750,7 @@ def _run_job_cmd(self, cmd_key, suite, itasks, callback): if LOG.isEnabledFor(DEBUG): cmd.append("--debug") cmd.append("--") - cmd.append(get_remote_suite_run_job_dir(platform, suite)) + cmd.append(get_remote_suite_run_job_dir(suite)) job_log_dirs = [] if remote_mode: cmd = construct_ssh_cmd(cmd, platform) @@ -1030,8 +1026,7 @@ def _prep_submit_task_job_impl(self, suite, itask, rtconfig): self._create_job_log_path(suite, itask) job_d = get_task_job_id( itask.point, itask.tdef.name, itask.submit_num) - job_file_path = get_remote_suite_run_job_dir( - itask.platform, suite, job_d, JOB_LOG_JOB) + job_file_path = get_remote_suite_run_job_dir(suite, job_d, JOB_LOG_JOB) return { 'job_runner_name': itask.platform['job runner'], 'job_runner_command_template': ( diff --git a/cylc/flow/task_remote_mgr.py b/cylc/flow/task_remote_mgr.py index 99118292ac0..00a63a46d22 100644 --- a/cylc/flow/task_remote_mgr.py +++ b/cylc/flow/task_remote_mgr.py @@ -198,7 +198,7 @@ def remote_init( if cylc.flow.flags.debug: cmd.append('--debug') cmd.append(str(install_target)) - cmd.append(get_remote_suite_run_dir(platform, self.suite)) + cmd.append(get_remote_suite_run_dir(self.suite)) dirs_to_symlink = get_dirs_to_symlink(install_target, self.suite) for key, value in dirs_to_symlink.items(): if value is not None: @@ -234,7 +234,7 @@ def remote_tidy(self): if cylc.flow.flags.debug: cmd.append('--debug') cmd.append(install_target) - cmd.append(get_remote_suite_run_dir(platform, self.suite)) + cmd.append(get_remote_suite_run_dir(self.suite)) cmd = construct_ssh_cmd(cmd, platform, timeout='10s') LOG.debug( "Removing authentication keys and contact file " @@ -348,7 +348,7 @@ def file_install(self, platform): install_target = platform['install target'] self.remote_init_map[install_target] = REMOTE_FILE_INSTALL_IN_PROGRESS src_path = get_workflow_run_dir(self.suite) - dst_path = get_remote_suite_run_dir(platform, self.suite) + dst_path = get_remote_suite_run_dir(self.suite) install_target = platform['install target'] ctx = SubProcContext( 'file-install', diff --git a/cylc/flow/xtriggers/suite_state.py b/cylc/flow/xtriggers/suite_state.py index 0457dc99ab2..998cb723710 100644 --- a/cylc/flow/xtriggers/suite_state.py +++ b/cylc/flow/xtriggers/suite_state.py @@ -18,8 +18,7 @@ from cylc.flow.cycling.util import add_offset from cylc.flow.dbstatecheck import CylcSuiteDBChecker -from cylc.flow.pathutil import expand_path -from cylc.flow.platforms import get_platform +from cylc.flow.pathutil import expand_path, get_workflow_run_dir from metomi.isodatetime.parsers import TimePointParser @@ -68,9 +67,10 @@ def suite_state(suite, task, point, offset=None, status='succeeded', to this xtrigger. """ - cylc_run_dir = expand_path( - cylc_run_dir or get_platform()['run directory'] - ) + if cylc_run_dir: + cylc_run_dir = expand_path(cylc_run_dir) + else: + cylc_run_dir = get_workflow_run_dir('') if offset is not None: point = str(add_offset(point, offset)) try: diff --git a/tests/flakyfunctional/cyclers/19-async_integer.t b/tests/flakyfunctional/cyclers/19-async_integer.t index 875756d6dc4..1c042d929d1 100755 --- a/tests/flakyfunctional/cyclers/19-async_integer.t +++ b/tests/flakyfunctional/cyclers/19-async_integer.t @@ -41,10 +41,9 @@ suite_run_ok "${TEST_NAME}" \ if [[ -f "${TEST_SOURCE_DIR}/${TEST_NAME_BASE}-find.out" ]]; then TEST_NAME="${TEST_NAME_BASE}-find" SUITE_RUN_DIR="${HOME}/cylc-run/${SUITE_NAME}" - SUITE_WRK_DIR="$(cylc config -i '[platforms][localhost]work directory')/${SUITE_NAME}" { (cd "${SUITE_RUN_DIR}" && find 'log/job' -type f) - (cd "${SUITE_WRK_DIR}" && find 'work' -type f) + (cd "${SUITE_RUN_DIR}" && find 'work' -type f) } | sort -V >"${TEST_NAME}" cmp_ok "${TEST_NAME}" "${TEST_SOURCE_DIR}/${TEST_NAME_BASE}-find.out" fi diff --git a/tests/functional/cylc-get-site-config/04-homeless.t b/tests/functional/cylc-get-site-config/04-homeless.t index 2880e1c1170..bcd3f4fcca9 100644 --- a/tests/functional/cylc-get-site-config/04-homeless.t +++ b/tests/functional/cylc-get-site-config/04-homeless.t @@ -15,16 +15,21 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test on absence HOME (cylc/cylc-flow#2895) +# Test absence of HOME env var (https://github.com/cylc/cylc-flow/pull/2895) . "$(dirname "$0")/test_header" set_test_number 3 -create_test_global_config '' '' +# shellcheck disable=SC2016 +create_test_global_config '' ' +[symlink dirs] + [[localhost]] + run = $HOME/dr-malcolm +' run_ok "${TEST_NAME_BASE}" \ env -u HOME \ - cylc config --item='[platforms][localhost]work directory' -cmp_ok "${TEST_NAME_BASE}.stdout" <<<"\$HOME/cylc-run" + cylc config --item='[symlink dirs][localhost]run' +cmp_ok "${TEST_NAME_BASE}.stdout" <<<"\$HOME/dr-malcolm" cmp_ok "${TEST_NAME_BASE}.stderr" <'/dev/null' exit diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 0f485b71188..dc4aa7f775c 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -25,14 +25,11 @@ import pytest from cylc.flow.cfgspec.glbl_cfg import glbl_cfg +from cylc.flow.pathutil import get_workflow_run_dir from cylc.flow.wallclock import get_current_time_string -from cylc.flow.platforms import platform_from_name from cylc.flow.rundb import CylcSuiteDAO -from .utils import ( - _expanduser, - _rm_if_empty -) +from .utils import _rm_if_empty from .utils.flow_tools import ( _make_flow, _make_scheduler, @@ -82,11 +79,9 @@ def _pytest_passed(request): @pytest.fixture(scope='session') -def run_dir(request): +def run_dir(): """The cylc run directory for this host.""" - path = _expanduser( - platform_from_name()['run directory'] - ) + path = Path(get_workflow_run_dir('')) path.mkdir(exist_ok=True) yield path diff --git a/tests/integration/utils/__init__.py b/tests/integration/utils/__init__.py index 27ab2c5a832..e388da6909c 100644 --- a/tests/integration/utils/__init__.py +++ b/tests/integration/utils/__init__.py @@ -22,7 +22,6 @@ """ import asyncio -from pathlib import Path def _rm_if_empty(path): @@ -57,17 +56,3 @@ async def _poll_file(path, timeout=2, step=0.1, exists=True): if elapsed > timeout: raise Exception(f'Timeout waiting for file creation: {path}') return True - - -def _expanduser(path): - """Expand $HOME and ~ in paths. - - This code may well become obsolete after job platforms work has been - merged. - - """ - path = str(path) - path = path.replace('$HOME', '~') - path = path.replace('${HOME}', '~') - path = Path(path).expanduser() - return path diff --git a/tests/integration/utils/test_utils.py b/tests/integration/utils/test_utils.py index f1d9b855c94..ca722260861 100644 --- a/tests/integration/utils/test_utils.py +++ b/tests/integration/utils/test_utils.py @@ -28,7 +28,6 @@ from . import ( _rm_if_empty, _poll_file, - _expanduser ) @@ -52,10 +51,3 @@ async def test_poll_file(tmp_path): await _poll_file(path, exists=False) path.touch() await _poll_file(path, exists=True) - - -def test_expanduser(): - """It should expand ~ and $HOME.""" - assert _expanduser('a/~/b') == Path('a/~/b').expanduser() - assert _expanduser('a/$HOME/b') == Path('a/~/b').expanduser() - assert _expanduser('a/${HOME}/b') == Path('a/~/b').expanduser() diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 4134e09eb51..77e2e7afe65 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -15,8 +15,10 @@ # along with this program. If not, see . """Standard pytest fixtures for unit tests.""" from cylc.flow.data_store_mgr import DataStoreMgr +from pathlib import Path import pytest from shutil import rmtree +from typing import Optional from unittest.mock import create_autospec, Mock from cylc.flow.cfgspec.globalcfg import SPEC @@ -26,9 +28,32 @@ ) from cylc.flow.parsec.config import ParsecConfig from cylc.flow.scheduler import Scheduler +from cylc.flow.suite_files import SuiteFiles from cylc.flow.xtrigger_mgr import XtriggerManager +@pytest.fixture +def tmp_run_dir(tmp_path: Path, monkeypatch: pytest.MonkeyPatch): + """Fixture that patches the cylc-run dir to the tests's {tmp_path}/cylc-run + and optionally creates a workflow run dir inside. + + Args: + reg: Workflow name. + """ + def inner(reg: Optional[str] = None) -> Path: + cylc_run_dir = tmp_path.joinpath('cylc-run') + cylc_run_dir.mkdir(exist_ok=True) + monkeypatch.setattr('cylc.flow.pathutil._CYLC_RUN_DIR', cylc_run_dir) + if reg: + run_dir = cylc_run_dir.joinpath(reg) + run_dir.mkdir(parents=True, exist_ok=True) + run_dir.joinpath(SuiteFiles.FLOW_FILE).touch(exist_ok=True) + run_dir.joinpath(SuiteFiles.Service.DIRNAME).mkdir(exist_ok=True) + return run_dir + return cylc_run_dir + return inner + + @pytest.fixture def cycling_mode(monkeypatch): """Set the Cylc cycling mode and return its value.""" diff --git a/tests/unit/test_job_file.py b/tests/unit/test_job_file.py index be1ad279a2f..a2a609edd81 100644 --- a/tests/unit/test_job_file.py +++ b/tests/unit/test_job_file.py @@ -20,7 +20,7 @@ import io import os import pytest -from tempfile import TemporaryFile, NamedTemporaryFile +from tempfile import NamedTemporaryFile from unittest import mock from cylc.flow import __version__ @@ -280,11 +280,6 @@ def test_write_prelude(monkeypatch, fixture_get_platform): def test_write_suite_environment(fixture_get_platform, monkeypatch): """Test suite environment is correctly written in jobscript""" # set some suite environment conditions - monkeypatch.setattr( - cylc.flow.job_file, - "get_remote_suite_work_dir", - lambda a, b: "work/dir" - ) cylc.flow.flags.debug = True cylc.flow.flags.verbose = True suite_env = {'CYLC_UTC': 'True', @@ -296,7 +291,6 @@ def test_write_suite_environment(fixture_get_platform, monkeypatch): 'ENVIRONMENT:\n export CYLC_CYCLING_MODE="integer"\n ' ' export CYLC_UTC="True"\n export TZ="UTC"\n\n ' ' export CYLC_SUITE_RUN_DIR="cylc-run/farm_noises"\n ' - ' export CYLC_SUITE_WORK_DIR_ROOT="work/dir"\n ' ' export CYLC_SUITE_UUID="neigh"') job_conf = { "platform": fixture_get_platform({ @@ -317,12 +311,6 @@ def test_write_suite_environment_no_remote_suite_d( fixture_get_platform, monkeypatch ): """Test suite environment is correctly written in jobscript""" - - monkeypatch.setattr( - cylc.flow.job_file, - "get_remote_suite_work_dir", - lambda a, b: "work/dir" - ) cylc.flow.flags.debug = True cylc.flow.flags.verbose = True suite_env = {'CYLC_UTC': 'True', @@ -333,8 +321,7 @@ def test_write_suite_environment_no_remote_suite_d( 'ENVIRONMENT:\n export CYLC_CYCLING_MODE="integer"\n ' 'export CYLC_UTC="True"\n export TZ="UTC"\n\n export ' 'CYLC_SUITE_RUN_DIR="cylc-run/farm_noises"\n ' - 'export CYLC_SUITE_WORK_DIR_ROOT="work/dir"\n ' - ' export CYLC_SUITE_UUID="neigh"') + 'export CYLC_SUITE_UUID="neigh"') job_conf = { "platform": fixture_get_platform({ "host": "localhost", diff --git a/tests/unit/test_pathutil.py b/tests/unit/test_pathutil.py index d7b5285c029..10c3ef9dc12 100644 --- a/tests/unit/test_pathutil.py +++ b/tests/unit/test_pathutil.py @@ -18,9 +18,9 @@ import logging import os from pathlib import Path -from typing import Callable, List +from typing import Callable, Iterable, List import pytest -from unittest.mock import Mock, patch, call +from unittest.mock import patch, call from cylc.flow.exceptions import WorkflowFilesError from cylc.flow.pathutil import ( @@ -28,7 +28,6 @@ get_dirs_to_symlink, get_remote_suite_run_dir, get_remote_suite_run_job_dir, - get_remote_suite_work_dir, get_workflow_run_dir, get_suite_run_job_dir, get_suite_run_log_dir, @@ -66,46 +65,31 @@ def test_expand_path( @pytest.mark.parametrize( 'func, extra_args, expected', [ - (get_remote_suite_run_dir, (), "$HOME/annapurna/foo"), + (get_remote_suite_run_dir, (), "$HOME/cylc-run/foo"), ( get_remote_suite_run_dir, ("comes", "true"), - "$HOME/annapurna/foo/comes/true", + "$HOME/cylc-run/foo/comes/true", ), ( get_remote_suite_run_job_dir, (), - "$HOME/annapurna/foo/log/job"), + "$HOME/cylc-run/foo/log/job"), ( get_remote_suite_run_job_dir, ("comes", "true"), - "$HOME/annapurna/foo/log/job/comes/true", - ), - (get_remote_suite_work_dir, (), "$HOME/K2/foo"), - ( - get_remote_suite_work_dir, - ("comes", "true"), - "$HOME/K2/foo/comes/true", - ), + "$HOME/cylc-run/foo/log/job/comes/true", + ) ] ) def test_get_remote_suite_run_dirs( - func, extra_args, expected -): - """ - Tests for get_remote_suite_run_[|job|work]_dir - Pick a unusual cylc dir names to ensure not picking up system settings - Pick different names for run and work dir to ensure that the test - isn't passing by accident. - """ - platform = { - 'run directory': '$HOME/annapurna', - 'work directory': '$HOME/K2', - } + func: Callable, extra_args: Iterable[str], expected: str, +) -> None: + """Tests for get_remote_suite_run_[|job|work]_dir""" if extra_args: - result = func(platform, 'foo', *extra_args) + result = func('foo', *extra_args) else: - result = func(platform, 'foo') + result = func('foo') assert result == expected @@ -123,9 +107,7 @@ def test_get_remote_suite_run_dirs( [([], ''), (['comes', 'true'], '/comes/true')] ) -@patch('cylc.flow.pathutil.platform_from_name') def test_get_workflow_run_dirs( - mocked_platform: Mock, func: Callable, tail1: str, args: List[str], tail2: str ) -> None: """Usage of get_suite_run_*dir. @@ -137,14 +119,9 @@ def test_get_workflow_run_dirs( tail2: expected tail of return value from extra args """ homedir = os.getenv("HOME") - mocked_platform.return_value = { - 'run directory': '$HOME/cylc-run', - 'work directory': '$HOME/cylc-run' - } expected_result = f'{homedir}/cylc-run/my-workflow/dream{tail1}{tail2}' assert func('my-workflow/dream', *args) == expected_result - mocked_platform.assert_called_with() @pytest.mark.parametrize( @@ -153,11 +130,7 @@ def test_get_workflow_run_dirs( (get_suite_run_pub_db_name, '/log/db'), (get_suite_test_log_name, '/log/suite/reftest.log')] ) -@patch('cylc.flow.pathutil.platform_from_name') -def test_get_suite_run_names( - mocked_platform: Mock, - func: Callable, tail: str -) -> None: +def test_get_suite_run_names(func: Callable, tail: str) -> None: """Usage of get_suite_run_*name. Params: @@ -166,45 +139,29 @@ def test_get_suite_run_names( tail: expected tail of return value from configuration """ homedir = os.getenv("HOME") - mocked_platform.return_value = { - 'run directory': '$HOME/cylc-run', - 'work directory': '$HOME/cylc-run' - } assert ( func('my-suite/dream') == f'{homedir}/cylc-run/my-suite/dream{tail}' ) - mocked_platform.assert_called_with() - -@pytest.mark.parametrize( - 'subdir', - [ - '', - '/log/suite', - '/log/job', - '/log/flow-config', - '/share', - '/work' - ] -) -def test_make_suite_run_tree(caplog, tmpdir, mock_glbl_cfg, subdir): - glbl_conf_str = f''' - [platforms] - [[localhost]] - run directory = {tmpdir} - work directory = {tmpdir} - ''' - mock_glbl_cfg('cylc.flow.platforms.glbl_cfg', glbl_conf_str) - mock_glbl_cfg('cylc.flow.pathutil.glbl_cfg', glbl_conf_str) - - caplog.set_level(logging.DEBUG) +def test_make_suite_run_tree( + tmp_run_dir: Callable, caplog: pytest.LogCaptureFixture +) -> None: + run_dir: Path = tmp_run_dir('my-workflow') + caplog.set_level(logging.DEBUG) # Only used for debugging test make_suite_run_tree('my-workflow') - # Check that directories have been created - assert (tmpdir / 'my-workflow' / subdir).isdir() is True + for subdir in [ + '', + 'log/suite', + 'log/job', + 'log/flow-config', + 'share', + 'work' + ]: + assert (run_dir / subdir).is_dir() is True @pytest.mark.parametrize( diff --git a/tests/unit/test_suite_files.py b/tests/unit/test_suite_files.py index 5a30bcdaf4f..b33c8a97396 100644 --- a/tests/unit/test_suite_files.py +++ b/tests/unit/test_suite_files.py @@ -37,38 +37,16 @@ CleanOpts = Options(_clean_GOP()) -@pytest.fixture -def tmp_run_dir(tmp_path: Path, monkeypatch: pytest.MonkeyPatch): - """Fixture that patches the cylc-run dir to the tests's {tmp_path}/cylc-run - and optionally creates a workflow run dir inside. - - Args: - reg: Workflow name. - """ - def inner(reg: Optional[str] = None) -> Path: - cylc_run_dir = tmp_path.joinpath('cylc-run') - cylc_run_dir.mkdir(exist_ok=True) - for module in ('suite_files', 'pathutil'): - monkeypatch.setattr(f'cylc.flow.{module}.get_workflow_run_dir', - lambda *a: cylc_run_dir.joinpath(*a)) - if reg: - run_dir = cylc_run_dir.joinpath(reg) - run_dir.mkdir(parents=True, exist_ok=True) - run_dir.joinpath(SuiteFiles.FLOW_FILE).touch(exist_ok=True) - run_dir.joinpath(SuiteFiles.Service.DIRNAME).mkdir(exist_ok=True) - return run_dir - return cylc_run_dir - return inner - - @pytest.mark.parametrize( 'path, expected', [('a/b/c', '/mock_cylc_dir/a/b/c'), ('/a/b/c', '/a/b/c')] ) -def test_get_cylc_run_abs_path(path, expected, monkeypatch): - monkeypatch.setattr('cylc.flow.pathutil.platform_from_name', - lambda: {'run directory': '/mock_cylc_dir'}) +def test_get_cylc_run_abs_path( + path: str, expected: str, + monkeypatch: pytest.MonkeyPatch +) -> None: + monkeypatch.setattr('cylc.flow.pathutil._CYLC_RUN_DIR', '/mock_cylc_dir') assert suite_files.get_cylc_run_abs_path(path) == expected From 7e18e414aa26b3a7ff6d664fbda8d187f9c45221 Mon Sep 17 00:00:00 2001 From: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> Date: Thu, 15 Apr 2021 11:51:52 +0100 Subject: [PATCH 2/7] Remove global "suite definition directory" config item [platforms][X]suite definition directory --- cylc/flow/cfgspec/globalcfg.py | 1 - cylc/flow/etc/syntax/cylc.lang | 1 - cylc/flow/etc/syntax/cylc.xml | 1 - cylc/flow/scripts/diff.py | 2 +- cylc/flow/task_job_mgr.py | 1 - tests/unit/test_job_file.py | 34 +--------------------------------- 6 files changed, 2 insertions(+), 38 deletions(-) diff --git a/cylc/flow/cfgspec/globalcfg.py b/cylc/flow/cfgspec/globalcfg.py index 8a68cdc50c2..fd295c4ebd2 100644 --- a/cylc/flow/cfgspec/globalcfg.py +++ b/cylc/flow/cfgspec/globalcfg.py @@ -423,7 +423,6 @@ ''') Conf('job runner command template', VDR.V_STRING) Conf('shell', VDR.V_STRING, '/bin/bash') - Conf('suite definition directory', VDR.V_STRING) Conf('communication method', VDR.V_STRING, 'zmq', options=['zmq', 'poll', 'ssh'], desc=''' The means by which task progress messages are reported back to diff --git a/cylc/flow/etc/syntax/cylc.lang b/cylc/flow/etc/syntax/cylc.lang index c1264b55147..9ee5ba474fb 100644 --- a/cylc/flow/etc/syntax/cylc.lang +++ b/cylc/flow/etc/syntax/cylc.lang @@ -105,7 +105,6 @@ task parameters task event batch interval suite state polling - suite definition directory succeeded handler submitted handler submission timeout handler diff --git a/cylc/flow/etc/syntax/cylc.xml b/cylc/flow/etc/syntax/cylc.xml index 8aa0a607f42..e35b333356b 100644 --- a/cylc/flow/etc/syntax/cylc.xml +++ b/cylc/flow/etc/syntax/cylc.xml @@ -31,7 +31,6 @@ - diff --git a/cylc/flow/scripts/diff.py b/cylc/flow/scripts/diff.py index a791f2966ae..edf43f9c5cf 100755 --- a/cylc/flow/scripts/diff.py +++ b/cylc/flow/scripts/diff.py @@ -26,7 +26,7 @@ after inlining has occurred. Files in the suite bin directory and other sub-directories of the -suite definition directory are not currently differenced.""" +run directory are not currently differenced.""" import sys diff --git a/cylc/flow/task_job_mgr.py b/cylc/flow/task_job_mgr.py index b79cba23fbf..de6bb69fc4d 100644 --- a/cylc/flow/task_job_mgr.py +++ b/cylc/flow/task_job_mgr.py @@ -1047,7 +1047,6 @@ def _prep_submit_task_job_impl(self, suite, itask, rtconfig): 'param_var': itask.tdef.param_var, 'post-script': scripts[2], 'pre-script': scripts[0], - 'remote_suite_d': itask.platform['suite definition directory'], 'script': scripts[1], 'submit_num': itask.submit_num, 'flow_label': itask.flow_label, diff --git a/tests/unit/test_job_file.py b/tests/unit/test_job_file.py index a2a609edd81..5d7ce26c195 100644 --- a/tests/unit/test_job_file.py +++ b/tests/unit/test_job_file.py @@ -82,7 +82,6 @@ def test_write(mocked_get_remote_suite_run_dir, fixture_get_platform): "task_id": "baa", "suite_name": "farm_noises", "work_d": "farm_noises/work_d", - "remote_suite_d": "remote/suite/dir", "uuid_str": "neigh", 'environment': {'cow': '~/moo', 'sheep': '~baa/baa', @@ -277,7 +276,7 @@ def test_write_prelude(monkeypatch, fixture_get_platform): assert(fake_file.getvalue() == expected) -def test_write_suite_environment(fixture_get_platform, monkeypatch): +def test_write_suite_environment(fixture_get_platform): """Test suite environment is correctly written in jobscript""" # set some suite environment conditions cylc.flow.flags.debug = True @@ -297,7 +296,6 @@ def test_write_suite_environment(fixture_get_platform, monkeypatch): "host": "localhost", }), "suite_name": "farm_noises", - "remote_suite_d": "remote/suite/dir", "uuid_str": "neigh" } rund = "cylc-run/farm_noises" @@ -307,36 +305,6 @@ def test_write_suite_environment(fixture_get_platform, monkeypatch): assert result == expected -def test_write_suite_environment_no_remote_suite_d( - fixture_get_platform, monkeypatch -): - """Test suite environment is correctly written in jobscript""" - cylc.flow.flags.debug = True - cylc.flow.flags.verbose = True - suite_env = {'CYLC_UTC': 'True', - 'CYLC_CYCLING_MODE': 'integer'} - job_file_writer = JobFileWriter() - job_file_writer.set_suite_env(suite_env) - expected = ('\n\ncylc__job__inst__cylc_env() {\n # CYLC SUITE ' - 'ENVIRONMENT:\n export CYLC_CYCLING_MODE="integer"\n ' - 'export CYLC_UTC="True"\n export TZ="UTC"\n\n export ' - 'CYLC_SUITE_RUN_DIR="cylc-run/farm_noises"\n ' - 'export CYLC_SUITE_UUID="neigh"') - job_conf = { - "platform": fixture_get_platform({ - "host": "localhost", - }), - "suite_name": "farm_noises", - "uuid_str": "neigh", - "remote_suite_d": "" - } - rund = "cylc-run/farm_noises" - with io.StringIO() as fake_file: - job_file_writer._write_suite_environment(fake_file, job_conf, rund) - result = fake_file.getvalue() - assert result == expected - - def test_write_script(): """Test script is correctly written in jobscript""" From 73f8c5bb9c646e731bafa36630502b0556ceb0a3 Mon Sep 17 00:00:00 2001 From: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> Date: Fri, 16 Apr 2021 12:26:32 +0100 Subject: [PATCH 3/7] Remove obsolete --template opt from suite-state --- cylc/flow/scripts/suite_state.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/cylc/flow/scripts/suite_state.py b/cylc/flow/scripts/suite_state.py index 554a137b859..43126737046 100755 --- a/cylc/flow/scripts/suite_state.py +++ b/cylc/flow/scripts/suite_state.py @@ -53,6 +53,7 @@ import sqlite3 import sys from time import sleep +from typing import TYPE_CHECKING from cylc.flow.exceptions import CylcError, UserInputError import cylc.flow.flags @@ -66,6 +67,9 @@ from metomi.isodatetime.parsers import TimePointParser +if TYPE_CHECKING: + from optparse import Values + class SuitePoller(Poller): """A polling object that checks suite state.""" @@ -120,7 +124,7 @@ def check(self): self.args['status'], self.args['message']) -def get_option_parser(): +def get_option_parser() -> COP: parser = COP(__doc__) parser.add_option( @@ -139,11 +143,6 @@ def get_option_parser(): "Shorthand for --point=$CYLC_TASK_CYCLE_POINT", action="store_true", dest="use_task_point", default=False) - parser.add_option( - "--template", metavar="TEMPLATE", - help="Remote cyclepoint template (IGNORED - this is now determined " - "automatically).", action="store", dest="template") - parser.add_option( "-d", "--run-dir", help="The top level cylc run directory if non-standard. The " @@ -182,7 +181,7 @@ def get_option_parser(): @cli_function(get_option_parser, remove_opts=["--db"]) -def main(parser, options, suite): +def main(parser: COP, options: 'Values', suite: str) -> None: if options.use_task_point and options.cycle: raise UserInputError( "cannot specify a cycle point and use environment variable") @@ -197,10 +196,6 @@ def main(parser, options, suite): raise UserInputError( "You must target a cycle point to use an offset") - if options.template: - print("WARNING: ignoring --template (no longer needed)", - file=sys.stderr) - # Attempt to apply specified offset to the targeted cycle if options.offset: options.cycle = str(add_offset(options.cycle, options.offset)) From 78132f19ca932b125e0f4c8ee404d69b0352eabc Mon Sep 17 00:00:00 2001 From: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> Date: Fri, 16 Apr 2021 13:17:33 +0100 Subject: [PATCH 4/7] Tidy --- cylc/flow/cfgspec/globalcfg.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/cylc/flow/cfgspec/globalcfg.py b/cylc/flow/cfgspec/globalcfg.py index fd295c4ebd2..30e43e46f8b 100644 --- a/cylc/flow/cfgspec/globalcfg.py +++ b/cylc/flow/cfgspec/globalcfg.py @@ -822,30 +822,25 @@ class GlobalConfig(ParsecConfig): CONF_BASENAME: str = "global.cylc" DEFAULT_SITE_CONF_PATH: str = os.path.join(os.sep, 'etc', 'cylc') USER_CONF_PATH: str = os.path.join( - os.getenv('HOME') or get_user_home(), - '.cylc', - 'flow' + os.getenv('HOME') or get_user_home(), '.cylc', 'flow' ) VERSION_HIERARCHY: List[str] = get_version_hierarchy(CYLC_VERSION) - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: + site_conf_root = ( + os.getenv('CYLC_SITE_CONF_PATH') or self.DEFAULT_SITE_CONF_PATH + ) self.conf_dir_hierarchy: List[Tuple[str, str]] = [ *[ - ( - upgrader.SITE_CONFIG, - os.path.join( - ( - os.getenv('CYLC_SITE_CONF_PATH') - or self.DEFAULT_SITE_CONF_PATH - ), - 'flow', - ver - ) - ) + (upgrader.SITE_CONFIG, + os.path.join(site_conf_root, 'flow', ver)) for ver in self.VERSION_HIERARCHY ], - *[(upgrader.USER_CONFIG, os.path.join(self.USER_CONF_PATH, ver)) - for ver in self.VERSION_HIERARCHY] + *[ + (upgrader.USER_CONFIG, + os.path.join(self.USER_CONF_PATH, ver)) + for ver in self.VERSION_HIERARCHY + ] ] super().__init__(*args, **kwargs) From b89c17f0ae4d8b992c3c50faeba6f449f1152e59 Mon Sep 17 00:00:00 2001 From: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> Date: Thu, 22 Apr 2021 10:38:27 +0100 Subject: [PATCH 5/7] Update changelog --- CHANGES.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 7efeef8bb2d..f10eb239cb0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -46,6 +46,16 @@ creating a new release entry be sure to copy & paste the span tag with the `actions:bind` attribute, which is used by a regex to find the text to be updated. Only the first match gets replaced, so it's fine to leave the old ones in. --> +------------------------------------------------------------------------------- +## __cylc-8.0b2 (Released 2021-??-??)__ + +### Enhancements + +[#4177](https://github.com/cylc/cylc-flow/pull/4177) - Remove obsolete +configuration items from `global.cylc[platforms][]`: +`run directory`, `work directory` and `suite definition directory`. This +functionality is now provided by `[symlink dirs]`. + ------------------------------------------------------------------------------- ## __cylc-8.0b1 (Released 2021-04-21)__ @@ -64,7 +74,7 @@ Replace the job "host" field with "platform" in the GraphQL schema. Fix a host ⇒ platform upgrade bug where host names were being popped from task configs causing subsequent tasks to run on localhost. -[#4173](https://github.com/cylc/cylc-flow/pull/4173) +[#4173](https://github.com/cylc/cylc-flow/pull/4173) - Fix the state totals shown in both the UI and TUI, including incorrect counts during workflow run and post pause. From 4bd32fca0bacefdc3a1caff74cf5a3b7ffb0f0d5 Mon Sep 17 00:00:00 2001 From: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> Date: Thu, 22 Apr 2021 10:40:29 +0100 Subject: [PATCH 6/7] Tidy --- cylc/flow/etc/job.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cylc/flow/etc/job.sh b/cylc/flow/etc/job.sh index 5f3f2622a9c..8b90e4a6456 100644 --- a/cylc/flow/etc/job.sh +++ b/cylc/flow/etc/job.sh @@ -71,9 +71,8 @@ cylc__job__main() { echo # Derived environment variables export CYLC_SUITE_LOG_DIR="${CYLC_SUITE_RUN_DIR}/log/suite" - CYLC_SUITE_WORK_DIR_ROOT="${CYLC_SUITE_WORK_DIR_ROOT:-${CYLC_SUITE_RUN_DIR}}" - export CYLC_SUITE_SHARE_DIR="${CYLC_SUITE_WORK_DIR_ROOT}/share" - export CYLC_SUITE_WORK_DIR="${CYLC_SUITE_WORK_DIR_ROOT}/work" + export CYLC_SUITE_SHARE_DIR="${CYLC_SUITE_RUN_DIR}/share" + export CYLC_SUITE_WORK_DIR="${CYLC_SUITE_RUN_DIR}/work" CYLC_TASK_CYCLE_POINT="$(cut -d '/' -f 1 <<<"${CYLC_TASK_JOB}")" CYLC_TASK_NAME="$(cut -d '/' -f 2 <<<"${CYLC_TASK_JOB}")" export CYLC_TASK_NAME CYLC_TASK_CYCLE_POINT ISODATETIMEREF From be82cea3fd3309392e7d04534afbeeaa44e333ce Mon Sep 17 00:00:00 2001 From: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> Date: Thu, 22 Apr 2021 12:39:46 +0100 Subject: [PATCH 7/7] Remove test for obsolete suite-state template --- tests/functional/suite-state/04-template.t | 45 ------------------- .../functional/suite-state/template/flow.cylc | 13 ------ .../suite-state/template/reference.log | 4 -- 3 files changed, 62 deletions(-) delete mode 100755 tests/functional/suite-state/04-template.t delete mode 100644 tests/functional/suite-state/template/flow.cylc delete mode 100644 tests/functional/suite-state/template/reference.log diff --git a/tests/functional/suite-state/04-template.t b/tests/functional/suite-state/04-template.t deleted file mode 100755 index 6b2a2a85844..00000000000 --- a/tests/functional/suite-state/04-template.t +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash -# THIS FILE IS PART OF THE CYLC SUITE ENGINE. -# Copyright (C) NIWA & British Crown (Met Office) & Contributors. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -#------------------------------------------------------------------------------- -# Test cylc suite-state "template" option -. "$(dirname "$0")/test_header" -#------------------------------------------------------------------------------- -set_test_number 3 -#------------------------------------------------------------------------------- -install_suite "${TEST_NAME_BASE}_ref" 'template_ref' -SUITE_NAME_REF="${SUITE_NAME}" -#------------------------------------------------------------------------------- -TEST_NAME="${TEST_NAME_BASE}-ref" -suite_run_ok "${TEST_NAME}" \ - cylc play --reference-test --debug --no-detach "${SUITE_NAME_REF}" -#------------------------------------------------------------------------------- -TEST_NAME="${TEST_NAME_BASE}-cli-template" -run_ok "${TEST_NAME}" \ - cylc suite-state "${SUITE_NAME_REF}" -p '20100101T0000Z' \ - --template=%Y --max-polls=1 -#------------------------------------------------------------------------------- -install_suite "${TEST_NAME_BASE}" 'template' -TEST_NAME="${TEST_NAME_BASE}-runtime" -#------------------------------------------------------------------------------- -suite_run_ok "${TEST_NAME}" \ - cylc play --reference-test --debug --no-detach "${SUITE_NAME}" \ - --set="REF_SUITE='${SUITE_NAME_REF}'" -#------------------------------------------------------------------------------- -purge "${SUITE_NAME_REF}" -purge -#------------------------------------------------------------------------------- -exit 0 diff --git a/tests/functional/suite-state/template/flow.cylc b/tests/functional/suite-state/template/flow.cylc deleted file mode 100644 index 9b82c9fcde0..00000000000 --- a/tests/functional/suite-state/template/flow.cylc +++ /dev/null @@ -1,13 +0,0 @@ -#!jinja2 -[scheduler] - UTC mode = True -[scheduling] - initial cycle point = 20100101T0000Z - final cycle point = 20110101T0000Z - [[graph]] - P1Y = poll_foo<{{REF_SUITE}}::foo> - -[runtime] - [[poll_foo]] - [[[suite state polling]]] - template = %Y diff --git a/tests/functional/suite-state/template/reference.log b/tests/functional/suite-state/template/reference.log deleted file mode 100644 index 6523f5e3b1b..00000000000 --- a/tests/functional/suite-state/template/reference.log +++ /dev/null @@ -1,4 +0,0 @@ -2015-11-02T15:30:50Z INFO - Initial point: 20100101T0000Z -2015-11-02T15:30:50Z INFO - Final point: 20110101T0000Z -2015-11-02T15:30:50Z INFO - [poll_foo.20100101T0000Z] -triggered off [] -2015-11-02T15:30:52Z INFO - [poll_foo.20110101T0000Z] -triggered off []