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

global universal identifier #3931

Merged
merged 92 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from 87 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
4a57a21
setup: 8.0rc1.dev
oliver-sanders Nov 10, 2021
8c3d719
Merge remote-tracking branch 'upstream/master'
oliver-sanders Nov 17, 2021
8bb4ae3
Merge remote-tracking branch 'upstream/master'
oliver-sanders Dec 15, 2021
13a0afd
Merge remote-tracking branch 'upstream/master'
oliver-sanders Dec 28, 2021
cf87ffe
univseral id: tokeniser
oliver-sanders Oct 30, 2020
2d92e4b
universal id: tests
oliver-sanders Nov 6, 2020
2ee13ce
reg: don't allow a number as the first char in a reg
oliver-sanders Nov 6, 2020
547b39f
call_multi
oliver-sanders Dec 7, 2021
ef80cd7
cylc/flow/network/multi -> cylc/flow/id_cli
oliver-sanders Dec 7, 2021
82be12a
refactor
oliver-sanders Dec 8, 2021
7756f85
make a right mess of refactoring from parse_id to parse_ids
oliver-sanders Dec 8, 2021
25fa781
ok screw it let's rip the guts out
oliver-sanders Dec 9, 2021
ddb0912
semi-working; one runs to completion and generic works
oliver-sanders Dec 9, 2021
d2d2691
TODO
oliver-sanders Dec 13, 2021
5f3a737
update to new pool format
oliver-sanders Dec 14, 2021
d661bd3
task pool filter swap
oliver-sanders Dec 14, 2021
ab69c88
fixes
oliver-sanders Dec 14, 2021
18e748b
REBASE original: fix hier workflows
oliver-sanders Dec 14, 2021
a71b90b
REBASE original: allow one char integer cycles
oliver-sanders Dec 14, 2021
f36e15b
next batch of fun
oliver-sanders Dec 14, 2021
ad7477f
baeutifyssssss
oliver-sanders Dec 14, 2021
873b8de
REBASE next batch of fun
oliver-sanders Dec 15, 2021
718bd13
typing
oliver-sanders Dec 15, 2021
b1af5e7
id_match: add namespace support
oliver-sanders Dec 15, 2021
c433076
TESTS TESTS TESTS
oliver-sanders Dec 15, 2021
36266e3
command poller -> async
oliver-sanders Dec 16, 2021
41aae1b
fixes
oliver-sanders Dec 16, 2021
eecfeae
id_cli tests
oliver-sanders Dec 16, 2021
e7ce9ff
fix src stuiffs
oliver-sanders Dec 16, 2021
c34d545
REBASE tests
oliver-sanders Dec 16, 2021
5d7351a
refactor prereqs stuff
oliver-sanders Dec 16, 2021
db6dde5
REBASE prereqs
oliver-sanders Dec 16, 2021
4aeb703
more fixes incl filtering the hidden pool
oliver-sanders Dec 16, 2021
17e87d2
graph fixes etc
oliver-sanders Dec 16, 2021
8cc32db
.
oliver-sanders Dec 16, 2021
e7e17fe
resort reference logs
oliver-sanders Dec 16, 2021
2cb8585
TODO: dont validate workflow names for src dirs
oliver-sanders Dec 16, 2021
642dfbb
fixes
oliver-sanders Dec 16, 2021
683dfaa
event more fixes
oliver-sanders Dec 16, 2021
6bec276
fixes
oliver-sanders Dec 20, 2021
31ae33b
resolvers: TODO: tests/f/cylc-show/01-clock-triggered.t still failing
oliver-sanders Dec 20, 2021
7b7eb8e
fixes
oliver-sanders Dec 20, 2021
761e8a7
sort graph.plain.ref files
oliver-sanders Dec 20, 2021
f6156ff
fixes
oliver-sanders Dec 20, 2021
8a91859
fixes
oliver-sanders Dec 21, 2021
17c2ac2
test fixes
oliver-sanders Dec 21, 2021
f5f0c76
cylc show fixes
oliver-sanders Dec 22, 2021
68c7e5d
fixes fixes more bloddy fixes
oliver-sanders Dec 22, 2021
d7b1f95
task pool fiddling
oliver-sanders Dec 23, 2021
78b7505
tests/f: removed tests/functional/cylc-trigger/05-filter-cycles.t
oliver-sanders Dec 23, 2021
2b2d317
fixes
oliver-sanders Dec 23, 2021
958a975
suiterc deprecation support
oliver-sanders Dec 23, 2021
147a21b
even more fixes
oliver-sanders Dec 23, 2021
02e50d7
fixfixfix
oliver-sanders Dec 23, 2021
5350065
bye bye ID_DELIM
oliver-sanders Dec 23, 2021
8da3c8d
data_store_mgr fixes
oliver-sanders Dec 28, 2021
5750eaa
fixes
oliver-sanders Dec 28, 2021
2c669ec
x
oliver-sanders Jan 4, 2022
81de037
fix tui
oliver-sanders Jan 4, 2022
f658b36
cylc clean: allow cleaning multiple workflows
oliver-sanders Jan 4, 2022
02df23e
handle todos
oliver-sanders Jan 4, 2022
cec1128
fix
oliver-sanders Jan 4, 2022
190c3d6
tests
oliver-sanders Jan 4, 2022
042f8cc
mypy
oliver-sanders Jan 5, 2022
618f0fb
fix
oliver-sanders Jan 5, 2022
f7e7bae
cylc.flow.id_match: separate code and tests
oliver-sanders Jan 5, 2022
a0b8a68
added more tests
oliver-sanders Jan 5, 2022
2702efa
data_store: use $namespace and $edge prefixes for nodes
oliver-sanders Jan 5, 2022
2954491
tests/f: re-wrote graphql/02 as integration test
oliver-sanders Jan 6, 2022
f67886b
id: rationalised token functionality
oliver-sanders Jan 6, 2022
e54bd91
flake8: fix
oliver-sanders Jan 7, 2022
037bb73
fixes
oliver-sanders Jan 7, 2022
298f020
fix cylc show --task-def
oliver-sanders Jan 7, 2022
d5f2b39
feedback
oliver-sanders Jan 7, 2022
f455a80
tests ++
oliver-sanders Jan 7, 2022
0ebd6a0
remove spurious summary time
oliver-sanders Jan 10, 2022
da52750
tests/unit: add pytest.mark.asyncio to async tests
oliver-sanders Jan 10, 2022
9eaff8c
feedback
oliver-sanders Jan 10, 2022
fa2c946
feedback
oliver-sanders Jan 10, 2022
c8b5cd9
feedback
oliver-sanders Jan 10, 2022
efc2cc6
uid: remove lookbehind from uid regex
oliver-sanders Jan 11, 2022
0fdac60
changelog
oliver-sanders Jan 11, 2022
9fb689b
feedback
oliver-sanders Jan 11, 2022
b4181d2
portability: fix test with non-GNU grep
oliver-sanders Jan 13, 2022
7d9cd23
tests/f: fix flaky tests
oliver-sanders Jan 13, 2022
ccbfdb3
Merge branch 'master' into universal-id
hjoliver Jan 14, 2022
164dd49
Fix func test.
hjoliver Jan 14, 2022
e239df6
job-runner-handlers
oliver-sanders Jan 13, 2022
76770ea
uid: update cli docs with automatic multi workflow/task instructions
oliver-sanders Jan 14, 2022
8dcddda
feedback
oliver-sanders Jan 14, 2022
f8e5e2c
fix
oliver-sanders Jan 14, 2022
daa8f27
rst fix
oliver-sanders Jan 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ First Release Candidate for Cylc 8.

### Enhancements

[#3931](https://github.com/cylc/cylc-flow/pull/3931) -
Convert Cylc to use the new "Universal Identifier".

[#4506](https://github.com/cylc/cylc-flow/pull/4506) -
Cylc no longer creates a `flow.cylc` symlink to a `suite.rc` file.
This only affects you if you have used a prior Cylc 8 pre-release.
Expand Down
4 changes: 0 additions & 4 deletions cylc/flow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
"DEBUG": logging.DEBUG,
}

# Used widely with data element ID (internally and externally),
# scope may widen further with internal and CLI adoption.
ID_DELIM = '|'


def environ_init():
"""Initialise cylc environment."""
Expand Down
41 changes: 41 additions & 0 deletions cylc/flow/async_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,3 +417,44 @@ async def asyncqgen(queue):
"""Turn a queue into an async generator."""
while not queue.empty():
yield await queue.get()


async def unordered_map(coroutine, iterator):
"""An asynchronous map function which does not preserve order.

Use in situations where you want results as they are completed rather than
once they are all completed.

Example:
# define your async coroutine
>>> async def square(x): return x**2

# define your iterator (must yield tuples)
>>> iterator = [(num,) for num in range(5)]

# use `async for` to iterate over the results
# (sorted in this case so the test is repeatable)
>>> async def test():
... ret = []
... async for x in unordered_map(square, iterator):
... ret.append(x)
... return sorted(ret)
>>> asyncio.run(test())
[((0,), 0), ((1,), 1), ((2,), 4), ((3,), 9), ((4,), 16)]

"""
# create tasks
pending = []
for args in iterator:
task = asyncio.create_task(coroutine(*args))
task._args = args
pending.append(task)

# run tasks
while pending:
done, pending = await asyncio.wait(
pending,
return_when=asyncio.FIRST_COMPLETED
)
for task in done:
yield task._args, task.result()
oliver-sanders marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 9 additions & 5 deletions cylc/flow/broadcast_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@

from cylc.flow import LOG
from cylc.flow.broadcast_report import (
CHANGE_FMT, CHANGE_PREFIX_SET,
CHANGE_FMT,
CHANGE_PREFIX_SET,
get_broadcast_change_report,
get_broadcast_bad_options_report)
get_broadcast_bad_options_report,
)
from cylc.flow.id import Tokens
from cylc.flow.cycling.loader import get_point, standardise_point_string
from cylc.flow.exceptions import PointParsingError
from cylc.flow.task_id import TaskID

ALL_CYCLE_POINTS_STRS = ["*", "all-cycle-points", "all-cycles"]

Expand Down Expand Up @@ -154,7 +156,9 @@ def get_broadcast(self, task_id=None):
# all broadcasts requested
return self.broadcasts
try:
name, point_string = TaskID.split(task_id)
tokens = Tokens(task_id, relative=True)
name = tokens['task']
point_string = tokens['cycle']
except ValueError:
raise Exception("Can't split task_id %s" % task_id)

Expand Down Expand Up @@ -206,7 +210,7 @@ def _match_ext_trigger(self, itask):
if trig != qmsg:
continue
# Matched.
point_string = TaskID.split(itask.identity)[1]
point_string = itask.tokens['cycle']
# Set trigger satisfied.
itask.state.external_triggers[trig] = True
# Broadcast the event ID to the cycle point.
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/broadcast_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
BAD_OPTIONS_TITLE = "No broadcast to cancel/clear for these options:"
BAD_OPTIONS_TITLE_SET = ("Rejected broadcast: settings are not"
" compatible with the workflow")
CHANGE_FMT = "\n%(change)s [%(namespace)s.%(point)s] %(key)s=%(value)s"
CHANGE_FMT = "\n%(change)s [%(point)s/%(namespace)s] %(key)s=%(value)s"
oliver-sanders marked this conversation as resolved.
Show resolved Hide resolved
CHANGE_PREFIX_CANCEL = "-"
CHANGE_PREFIX_SET = "+"
CHANGE_TITLE_CANCEL = "Broadcast cancelled:"
Expand Down
6 changes: 3 additions & 3 deletions cylc/flow/command_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ def __init__(self, condition, interval, max_polls, args):
self.n_polls = 0
self.args = args # any extra parameters needed by check()

def check(self):
async def check(self):
"""Abstract method. Test polling condition."""
raise NotImplementedError()

def poll(self):
async def poll(self):
"""Poll for the condition embodied by self.check().
Return True if condition met, or False if polling exhausted."""

Expand All @@ -81,7 +81,7 @@ def poll(self):

while self.n_polls < self.max_polls:
self.n_polls += 1
if self.check():
if await self.check():
sys.stdout.write(": satisfied\n")
return True
if self.max_polls > 1:
Expand Down
59 changes: 46 additions & 13 deletions cylc/flow/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
get_sequence, get_sequence_cls, init_cyclers, get_dump_format,
INTEGER_CYCLING_TYPE, ISO8601_CYCLING_TYPE
)
from cylc.flow.id import Tokens
from cylc.flow.cycling.integer import IntegerInterval
from cylc.flow.cycling.iso8601 import ingest_time, ISO8601Interval
from cylc.flow.exceptions import (
Expand Down Expand Up @@ -100,7 +101,11 @@
)
from cylc.flow.wallclock import (
get_current_time_string, set_utc_mode, get_utc_mode)
from cylc.flow.workflow_files import NO_TITLE, WorkflowFiles
from cylc.flow.workflow_files import (
NO_TITLE,
WorkflowFiles,
check_deprecation,
)
from cylc.flow.xtrigger_mgr import XtriggerManager

if TYPE_CHECKING:
Expand Down Expand Up @@ -180,7 +185,7 @@ def __init__(
work_dir: Optional[str] = None,
share_dir: Optional[str] = None
) -> None:

check_deprecation(Path(fpath))
self.mem_log = mem_log_func
if self.mem_log is None:
self.mem_log = lambda x: None
Expand Down Expand Up @@ -689,10 +694,12 @@ def process_start_cycle_point(self) -> None:
# Start from designated task(s).
# Select the earliest start point for use in pre-initial ignore.
self.start_point = min(
get_point(
TaskID.split(taskid)[1]
).standardise()
for taskid in self.options.starttask
get_point(cycle).standardise()
for cycle in [
Tokens(taskid, relative=True)['cycle']
for taskid in self.options.starttask
]
if cycle
)
else:
# Start from the initial point.
Expand Down Expand Up @@ -830,7 +837,15 @@ def _check_circular(self):
for rhs, lhss in sorted(rhs2lhss.items()):
for lhs in sorted(lhss):
err_msg += ' %s => %s' % (
TaskID.get(*lhs), TaskID.get(*rhs))
Tokens(
cycle=str(lhs[1]),
task=lhs[0]
).relative_id,
Tokens(
cycle=str(rhs[1]),
task=rhs[0]
).relative_id,
)
if err_msg:
raise WorkflowConfigError(
'circular edges detected:' + err_msg)
Expand Down Expand Up @@ -1875,25 +1890,43 @@ def _close_families(l_id, r_id, clf_map):
lname, lpoint = None, None
if l_id:
lname, lpoint = l_id
lret = TaskID.get(lname, lpoint)
lret = Tokens(
cycle=str(lpoint),
task=lname,
).relative_id
rret = None
rname, rpoint = None, None
if r_id:
rname, rpoint = r_id
rret = TaskID.get(rname, rpoint)
rret = Tokens(
cycle=str(rpoint),
task=rname,
).relative_id

for fam_name, fam_members in clf_map.items():
if lname in fam_members and rname in fam_members:
# l and r are both members
lret = TaskID.get(fam_name, lpoint)
rret = TaskID.get(fam_name, rpoint)
lret = Tokens(
cycle=str(lpoint),
task=fam_name,
).relative_id
rret = Tokens(
cycle=str(rpoint),
task=fam_name,
).relative_id
break
elif lname in fam_members:
# l is a member
lret = TaskID.get(fam_name, lpoint)
lret = Tokens(
cycle=str(lpoint),
task=fam_name,
).relative_id
elif rname in fam_members:
# r is a member
rret = TaskID.get(fam_name, rpoint)
rret = Tokens(
cycle=str(rpoint),
task=fam_name,
).relative_id

return lret, rret

Expand Down
Loading