def test_coerce_interval(self): """Test coerce_interval.""" validator = CylcConfigValidator() # The good for value, result in [('', None), ('P3D', DurationFloat(259200)), ('PT10M10S', DurationFloat(610))]: self.assertEqual(validator.coerce_interval(value, ['whatever']), result) # The bad for value in ['None', '5 days', '20', '-12']: self.assertRaises(IllegalValueError, validator.coerce_interval, value, ['whatever'])
def test_coerce_interval_list(self): """Test coerce_interval_list.""" validator = CylcConfigValidator() # The good for value, results in [ ('', []), ('P3D', [DurationFloat(259200)]), ('P3D, PT10M10S', [DurationFloat(259200), DurationFloat(610)]), ('25*PT30M,10*PT1H', [DurationFloat(1800)] * 25 + [DurationFloat(3600)] * 10) ]: items = validator.coerce_interval_list(value, ['whatever']) for item, result in zip(items, results): self.assertAlmostEqual(item, result) # The bad for value in ['None', '5 days', '20', 'PT10S, -12']: self.assertRaises(IllegalValueError, validator.coerce_interval_list, value, ['whatever'])
'abort on inactivity': [VDR.V_BOOLEAN], 'mail events': [VDR.V_STRING_LIST, None], 'mail from': [VDR.V_STRING], 'mail smtp': [VDR.V_STRING], 'mail to': [VDR.V_STRING], 'mail footer': [VDR.V_STRING], }, 'reference test': { 'suite shutdown event handler': [VDR.V_STRING, 'cylc hook check-triggering'], 'required run mode': [VDR.V_STRING, '', 'live', 'simulation', 'dummy-local', 'dummy'], 'allow task failures': [VDR.V_BOOLEAN], 'expected task failures': [VDR.V_STRING_LIST], 'live mode suite timeout': [VDR.V_INTERVAL, DurationFloat(60)], 'dummy mode suite timeout': [VDR.V_INTERVAL, DurationFloat(60)], 'dummy-local mode suite timeout': [VDR.V_INTERVAL, DurationFloat(60)], 'simulation mode suite timeout': [VDR.V_INTERVAL, DurationFloat(60)], }, 'authentication': { # Allow owners to grant public shutdown rights at the most, not # full control. 'public': ([VDR.V_STRING, ''] + [ level.name.lower().replace('_', '-') for level in [ Priv.IDENTITY, Priv.DESCRIPTION, Priv.STATE_TOTALS, Priv.READ, Priv.SHUTDOWN ]
HEADINGS = ( None, 'task', 'state', 'host', 'job system', 'job ID', 'T-submit', 'T-start', 'T-finish', 'dT-mean', 'latest message',) # Nested dict of spec items. # Spec value is [value_type, default, allowed_2, allowed_3, ...] # where: # - value_type: value type (compulsory). # - default: the default value (optional). # - allowed_2, ...: the only other allowed values of this setting (optional). SPEC = { 'dot icon size': [ VDR.V_STRING, "medium", "small", "medium", "large", "extra large"], 'initial side-by-side views': [VDR.V_BOOLEAN], 'initial views': [VDR.V_STRING_LIST, ["text"]], 'maximum update interval': [VDR.V_INTERVAL, DurationFloat(15)], 'sort by definition order': [VDR.V_BOOLEAN, True], 'sort column': [VDR.V_STRING] + list(HEADINGS), 'sort column ascending': [VDR.V_BOOLEAN, True], 'sub-graphs on': [VDR.V_BOOLEAN, False], 'task filter highlight color': [VDR.V_STRING, 'PowderBlue'], 'task states to filter out': [ VDR.V_STRING_LIST, [TASK_STATUS_RUNAHEAD]], 'themes': { '__MANY__': { 'inherit': [VDR.V_STRING, "default"], 'defaults': [VDR.V_STRING_LIST], TASK_STATUS_WAITING: [VDR.V_STRING_LIST], TASK_STATUS_HELD: [VDR.V_STRING_LIST], TASK_STATUS_QUEUED: [VDR.V_STRING_LIST], TASK_STATUS_READY: [VDR.V_STRING_LIST],
from cylc import LOG from cylc.cfgvalidate import ( cylc_config_validate, CylcConfigValidator as VDR, DurationFloat) from cylc.hostuserutil import get_user_home, is_remote_user from cylc.network import Priv from cylc import __version__ as CYLC_VERSION # Nested dict of spec items. # Spec value is [value_type, default, allowed_2, allowed_3, ...] # where: # - value_type: value type (compulsory). # - default: the default value (optional). # - allowed_2, ...: the only other allowed values of this setting (optional). SPEC = { 'process pool size': [VDR.V_INTEGER, 4], 'process pool timeout': [VDR.V_INTERVAL, DurationFloat(600)], 'temporary directory': [VDR.V_STRING], 'state dump rolling archive length': [VDR.V_INTEGER, 10], 'disable interactive command prompts': [VDR.V_BOOLEAN, True], 'enable run directory housekeeping': [VDR.V_BOOLEAN], 'run directory rolling archive length': [VDR.V_INTEGER, 2], 'task host select command timeout': [VDR.V_INTERVAL, DurationFloat(10)], 'xtrigger function timeout': [VDR.V_INTERVAL, DurationFloat(10)], 'task messaging': { 'retry interval': [VDR.V_INTERVAL, DurationFloat(5)], 'maximum number of tries': [VDR.V_INTEGER, 7], 'connection timeout': [VDR.V_INTERVAL, DurationFloat(30)], }, 'cylc': { 'UTC mode': [VDR.V_BOOLEAN],
from cylc.cfgvalidate import ( cylc_config_validate, CylcConfigValidator as VDR, DurationFloat) USER_FILE = os.path.join(os.environ['HOME'], '.cylc', 'gscan.rc') # Nested dict of spec items. # Spec value is [value_type, default, allowed_2, allowed_3, ...] # where: # - value_type: value type (compulsory). # - default: the default value (optional). # - allowed_2, ...: the only other allowed values of this setting (optional). SPEC = { 'activate on startup': [VDR.V_BOOLEAN], 'columns': [VDR.V_STRING_LIST, ['suite', 'status']], 'suite listing update interval': [VDR.V_INTERVAL, DurationFloat(60)], 'suite status update interval': [VDR.V_INTERVAL, DurationFloat(15)], 'window size': [VDR.V_INTEGER_LIST, [300, 200]], 'hide main menubar': [VDR.V_BOOLEAN, False], } class GScanConfig(ParsecConfig): """Configuration for "gscan".""" COL_GROUP = "Group" COL_HOST = "Host" COL_OWNER = "Owner" COL_SUITE = "Suite" COL_TITLE = "Title" COL_UPDATED = "Updated"
DurationFloat) from cylc.hostuserutil import get_user_home, is_remote_user from cylc.mkdir_p import mkdir_p from cylc.network import PRIVILEGE_LEVELS, PRIV_STATE_TOTALS, PRIV_SHUTDOWN from cylc.version import CYLC_VERSION # Nested dict of spec items. # Spec value is [value_type, default, allowed_2, allowed_3, ...] # where: # - value_type: value type (compulsory). # - default: the default value (optional). # - allowed_2, ...: the only other allowed values of this setting (optional). SPEC = { 'process pool size': [VDR.V_INTEGER, 4], 'process pool timeout': [VDR.V_INTERVAL, DurationFloat(600)], 'temporary directory': [VDR.V_STRING], 'state dump rolling archive length': [VDR.V_INTEGER, 10], 'disable interactive command prompts': [VDR.V_BOOLEAN, True], 'enable run directory housekeeping': [VDR.V_BOOLEAN], 'run directory rolling archive length': [VDR.V_INTEGER, 2], 'task host select command timeout': [VDR.V_INTERVAL, DurationFloat(10)], 'xtrigger function timeout': [VDR.V_INTERVAL, DurationFloat(10)], 'task messaging': { 'retry interval': [VDR.V_INTERVAL, DurationFloat(5)], 'maximum number of tries': [VDR.V_INTEGER, 7], 'connection timeout': [VDR.V_INTERVAL, DurationFloat(30)], },
'latest message', ) # Nested dict of spec items. # Spec value is [value_type, default, allowed_2, allowed_3, ...] # where: # - value_type: value type (compulsory). # - default: the default value (optional). # - allowed_2, ...: the only other allowed values of this setting (optional). SPEC = { 'dot icon size': [VDR.V_STRING, "medium", "small", "medium", "large", "extra large"], 'initial side-by-side views': [VDR.V_BOOLEAN], 'initial views': [VDR.V_STRING_LIST, ["text"]], 'maximum update interval': [VDR.V_INTERVAL, DurationFloat(15)], 'sort by definition order': [VDR.V_BOOLEAN, True], 'sort column': [VDR.V_STRING] + list(HEADINGS), 'sort column ascending': [VDR.V_BOOLEAN, True], 'sub-graphs on': [VDR.V_BOOLEAN, False], 'task filter highlight color': [VDR.V_STRING, 'PowderBlue'], 'task states to filter out': [VDR.V_STRING_LIST, [TASK_STATUS_RUNAHEAD]], 'themes': { '__MANY__': { 'inherit': [VDR.V_STRING, "default"], 'defaults': [VDR.V_STRING_LIST], TASK_STATUS_WAITING: [VDR.V_STRING_LIST], TASK_STATUS_HELD: [VDR.V_STRING_LIST], TASK_STATUS_QUEUED: [VDR.V_STRING_LIST], TASK_STATUS_READY: [VDR.V_STRING_LIST], TASK_STATUS_EXPIRED: [VDR.V_STRING_LIST],