cylc / cylc-flow

Cylc: a workflow engine for cycling systems.
https://cylc.github.io
GNU General Public License v3.0
335 stars 94 forks source link

Python API #1962

Open hjoliver opened 8 years ago

hjoliver commented 8 years ago

We could easily provide a Python API for defining suites (and also reformulate our current suite.rc file parser a little to plug into it). For normal use, I can't see this being the recommended way of writing suites, compared with the current paradigm of config file + Jinja2 support, but maybe there's a case for defining workflows in Python programs as well. (And a few people seem to view it as a deficiency that we don't currently have this). This could even extend to skipping the graph string as a way to define dependencies.

benfitzpatrick commented 8 years ago

We've talked about this informally in Exeter before (or is there a proper issue?). There are suites that justifiably push the configuration file interface to the limits. My memory is that we were a bit divided about a Python API, but I think we thought that if someone else developed it, we wouldn't mind! The others may chip in.

This could even extend to skipping the graph string as a way to define dependencies.

I quite like the idea of also being able to define file-based dependencies for tasks, since that is what our dependencies nearly always are based around. Once you know what files a task needs, you can wrap it all up and push it to a platform with a different filesystem. Obviously this doesn't lend itself to the full dependency syntax power (no OR, no failure triggers, no suicide triggers).

arjclark commented 8 years ago

... I think we thought that if someone else developed it, we wouldn't mind!

That is pretty much my recollection too.

matthewrmshin commented 7 years ago

This does not have to be complicated. All we really need is an easy and documented way for users to generate the internal data structure of a parsed suite.rc in Python.

matthewrmshin commented 7 years ago

Just a bit more thoughts on this one. We can have decent APIs and/or documented ways to do these in Python programs:

hjoliver commented 5 years ago

Comment from Matt on Riot.im:

http://regent-lang.org/ This is work flow at the language level. We can probably learn something from this when we design the Python API.

hjoliver commented 3 years ago

Example from @oliver-sanders of multiple distinct graph sections:

    with cylc.graph() as start_up:
        make_something >> install_cold(platform)

    with cylc.graph() as workflow:
        foo >> bar >> baz
        bar & qux >> pub

    with cylc.graph() as wrap_up:
        post_process >> tidy

    cylc.run(
        start_up >> workflow.every('P1D') >> wrap_up
    )
oliver-sanders commented 3 years ago

(example taken from the wiki)

hjoliver commented 3 years ago

(example taken from the wiki)

(Ah, brilliant, forgot where that write-up was :+1: )