Skip to content

Commit

Permalink
tidy tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Jan 16, 2020
1 parent 0442cec commit 3ec35ff
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 29 deletions.
31 changes: 21 additions & 10 deletions cylc/flow/network/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,8 @@ class BroadcastSetting(InputObjectType):
required=True
)
value = String(
description='The value of the modification'
description='The value of the modification',
required=True
)


Expand Down Expand Up @@ -1320,7 +1321,8 @@ class Arguments:
workflows = List(WorkflowID, required=True)
name = String(
description='The checkpoint name.',
required=True)
required=True
)

result = GenericScalar()

Expand Down Expand Up @@ -1366,8 +1368,14 @@ class Arguments:

class TaskMutation:
class Arguments:
workflows = List(WorkflowID)
tasks = List(NamespaceIDGlob, required=True)
workflows = List(
WorkflowID,
required=True
)
tasks = List(
NamespaceIDGlob,
required=True
)

result = GenericScalar()

Expand Down Expand Up @@ -1405,11 +1413,13 @@ class Meta:
resolver = partial(mutator, command='insert_tasks')

class Arguments(TaskMutation.Arguments):
no_check = Boolean(
check_point = Boolean(
description=sstrip('''
Add task even if the provided cycle point is not valid for
the given task.
''')
Check that the provided cycle point is on one of the task's
recurrences as defined in the suite configuration before
inserting.
'''),
default_value=True
)
stop_point = CyclePoint(
description='hold/stop cycle point for inserted task.'
Expand All @@ -1433,8 +1443,9 @@ class Meta:
resolver = partial(mutator, command='poll_tasks')

class Arguments(TaskMutation.Arguments):
poll_succ = Boolean(
description='Allow polling of succeeded tasks.'
poll_succeeded = Boolean(
description='Allow polling of succeeded tasks.',
default_value=False
)


Expand Down
14 changes: 9 additions & 5 deletions cylc/flow/network/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,14 +735,14 @@ def state_totals(self):

@authorise(Priv.CONTROL)
@expose
def insert_tasks(self, tasks, stop_point_string=None, no_check=False):
def insert_tasks(self, tasks, stop_point=None, check_point=True):
"""Insert task proxies.
Args:
tasks (list):
A list of `task globs`_ (strings) which *cannot* contain
any glob characters (``*``).
stop_point_string (str, optional):
stop_point (str, optional):
Optional hold/stop cycle point for inserted task.
no_check (bool, optional):
Add task even if the provided cycle point is not valid
Expand All @@ -759,7 +759,11 @@ def insert_tasks(self, tasks, stop_point_string=None, no_check=False):
self.schd.command_queue.put((
"insert_tasks",
(tasks,),
{"stop_point_string": stop_point_string, "no_check": no_check}))
{
"stop_point_string": stop_point,
"check_point": check_point
}
))
return (True, 'Command queued')

@authorise(Priv.CONTROL)
Expand Down Expand Up @@ -842,7 +846,7 @@ def ping_task(self, task_id, exists_only=False):

@authorise(Priv.CONTROL)
@expose
def poll_tasks(self, tasks=None, poll_succ=False):
def poll_tasks(self, tasks=None, poll_succeeded=False):
"""Request the suite to poll task jobs.
Args:
Expand All @@ -861,7 +865,7 @@ def poll_tasks(self, tasks=None, poll_succ=False):
"""
self.schd.command_queue.put(
("poll_tasks", (tasks,), {"poll_succ": poll_succ}))
("poll_tasks", (tasks,), {"poll_succ": poll_succeeded}))
return (True, 'Command queued')

# TODO: deprecated by broadcast()
Expand Down
4 changes: 2 additions & 2 deletions cylc/flow/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,9 +994,9 @@ def command_remove_tasks(self, items, spawn=False):
return self.pool.remove_tasks(items, spawn)

def command_insert_tasks(self, items, stop_point_string=None,
no_check=False):
check_point=True):
"""Insert tasks."""
return self.pool.insert_tasks(items, stop_point_string, no_check)
return self.pool.insert_tasks(items, stop_point_string, check_point)

def command_nudge(self):
"""Cause the task processing loop to be invoked"""
Expand Down
4 changes: 2 additions & 2 deletions cylc/flow/scripts/cylc_insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def main(parser, options, suite, *items):

pclient(
'insert_tasks',
{'tasks': items, 'no_check': options.no_check,
'stop_point_string': options.stop_point_string},
{'tasks': items, 'check_point': not options.no_check,
'stop_point': options.stop_point_string},
timeout=options.comms_timeout
)

Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/scripts/cylc_poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def main(parser, options, suite, *task_globs):
options.comms_timeout)
pclient(
'poll_tasks',
{'tasks': task_globs, 'poll_succ': options.poll_succ}
{'tasks': task_globs, 'poll_succeeded': options.poll_succ}
)


Expand Down
4 changes: 2 additions & 2 deletions cylc/flow/task_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def assign_queues(self):
for queue, qconfig in self.config.cfg['scheduling']['queues'].items():
self.myq.update((name, queue) for name in qconfig['members'])

def insert_tasks(self, items, stopcp, no_check=False):
def insert_tasks(self, items, stopcp, check_point=True):
"""Insert tasks."""
n_warnings = 0
task_items = {}
Expand Down Expand Up @@ -144,7 +144,7 @@ def insert_tasks(self, items, stopcp, no_check=False):

# Check that the cycle point is on one of the tasks sequences.
point = get_point(key[1])
if not no_check: # Check if cycle point is on the tasks sequence.
if check_point: # Check if cycle point is on the tasks sequence.
for sequence in taskdef.sequences:
if sequence.is_on_sequence(point):
break
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/tests/network/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def setUp(self) -> None:
warnings = self.task_pool.insert_tasks(
items=[task_proxy.identity],
stopcp=None,
no_check=False
check_point=True
)
assert warnings == 0
self.task_pool.release_runahead_tasks()
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/tests/network/test_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def setUp(self) -> None:
warnings = self.task_pool.insert_tasks(
items=[task_proxy.identity],
stopcp=None,
no_check=False
check_point=True
)
assert 0 == warnings
self.task_pool.release_runahead_tasks()
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/tests/network/test_resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def setUp(self) -> None:
warnings = self.task_pool.insert_tasks(
items=[task_proxy.identity],
stopcp=None,
no_check=False
check_point=True
)
assert 0 == warnings
self.task_pool.release_runahead_tasks()
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/tests/network/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def setUp(self) -> None:
warnings = self.task_pool.insert_tasks(
items=[task_proxy.identity],
stopcp=None,
no_check=False
check_point=True
)
assert 0 == warnings
self.task_pool.release_runahead_tasks()
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/tests/network/test_subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def setUp(self) -> None:
warnings = self.task_pool.insert_tasks(
items=[task_proxy.identity],
stopcp=None,
no_check=False
check_point=True
)
assert warnings == 0
self.task_pool.release_runahead_tasks()
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/tests/test_data_store_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def setUp(self) -> None:
warnings = self.task_pool.insert_tasks(
items=[task_proxy.identity],
stopcp=None,
no_check=False
check_point=True
)
assert 0 == warnings
self.task_pool.release_runahead_tasks()
Expand Down
2 changes: 1 addition & 1 deletion tests/cylc-insert/12-cycle-500-tasks.t
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cut -d' ' -f 2- "${SUITE_RUN_DIR}/log/suite/log" >'trimmed-log'
for I in {001..500}; do
echo "INFO - [v_i${I}.2008] -submit-num=00, inserted"
done
echo "INFO - Command succeeded: insert_tasks(['2008/*'], stop_point_string=None, no_check=False)"
echo "INFO - Command succeeded: insert_tasks(['2008/*'], stop_point_string=None, check_point=True)"
} >'expected-log'
contains_ok 'trimmed-log' 'expected-log'

Expand Down

0 comments on commit 3ec35ff

Please sign in to comment.