Cylc-flow: Cylc and virtual environments

Created on 6 May 2019  Â·  9Comments  Â·  Source: cylc/cylc-flow

We need to be able to install Cylc into virtual environments. In the future we may even need to be able to do system-level installs into virtual environments (i.e. each Cylc release into its own venv) ... to avoid any risk of different Cylc versions with incompatible dependencies.

So for cylc-8, possibly in a venv (check off as solved in comments below):

  • [x] how can we ensure that jobs execute CLI from the right venv? (same or remote host)

  • [x] access to multiple cylc releases (potentically in their own venvs)

    • the currently central wrapper and $CYLC_VERSION should still work
  • [x] where should "site" global config files go?

    • a generic central location such as /etc/cylc-flow/global.rc? (nope/sort-of)
    • but version-specialized? etc/cylc-flow/8.0.0/global.rc? (nope/sort-of)
    • inside every cylc-flow installation (may be in a venv)? (nope)
    • https://github.com/cylc/cylc-flow/issues/3150#issuecomment-493029217:
      etc/cylc/<pkg-name>/<version>/<conf-file>
  • [x] how can users access "package resources" such as editor syntax files and bash command completion?

See also: #3081 #3080 #3133 #3134

UPDATE: pretty much done; will close the issue once global config file locations are implemented.

Most helpful comment

We may well amass a few configurations here, because Cylc components don't all have the same release cycle I imagine we may need something along the lines of:

  • /etc/cylc/flow/8.0.0/global.rc
  • /etc/cylc/flow/8.1.0/global.rc
  • /etc/cylc/ui-server/1.0.0/global.rc
  • /etc/cylc/ui-server/1.0.0/proxy.conf
  • ...

All 9 comments

UPDATE

[Original speculations on how to activate the right virtual environment for a particular cyc deleted]

Python virtual environments do not actually have to be "activated" so long as you know the location of installed scripts - because the scripts get modified by pip install so that they're hardwired to use the right Python interpreter and library. https://docs.python.org/3/library/venv.html:

You don’t specifically need to activate an environment; activation just prepends the virtual environment’s binary directory to your path, so that “python” invokes the virtual environment’s Python interpreter and you can run installed scripts without having to use their full path. However, all scripts installed in a virtual environment should be runnable without activating it, and run with the virtual environment’s Python automatically.

I think this means we can still use a central cylc wrapper and $CYLC_VERSION to select between different available cylc versions. The wrapper just needs to put (e.g.) /opt/cylc-flow/$CYLC_VERSION/venv/bin in $PATH. (And same mechanism as now to change $CYLC_HOME for developer copies...)

With the execption of cylc get-pkg-resources I think this will all hold true for Conda as well as virtualenv.

where should "site" global config files go?

A generic central location: /etc/cylc/flow/8.0.0/global.rc

Should be independent of packaging means.

etc/cylc/flow/8.0.0/global.rc or /etc/cylc/flow/8.0.0/global.rc @oliver-sanders ? (just checking if the first would be a package in cylc-flow?)

Whoops updated. /etc.

A generic central location: /etc/cylc/flow/8.0.0/global.rc

Sounds good to me too :+1:

We may well amass a few configurations here, because Cylc components don't all have the same release cycle I imagine we may need something along the lines of:

  • /etc/cylc/flow/8.0.0/global.rc
  • /etc/cylc/flow/8.1.0/global.rc
  • /etc/cylc/ui-server/1.0.0/global.rc
  • /etc/cylc/ui-server/1.0.0/proxy.conf
  • ...

I like.

In #3162 I've implemented a variation on @oliver-sanders suggestion:

  • /etc/cylc/flow/8.0a0/flow.rc

(This anticipates planned unification of suite.rc and global.rc; name not final as this might require some discussion)

might require some discussion

As flow is the name of a cylc module it doesn't quite make sense e.g:

  • /etc/cylc/flow/8.0a0/flow.rc
  • /etc/cylc/ui-server/1.0/flow.rc?
  • /etc/cylc/ui-server/1.0/ui-server.rc?

Suggestions:

  • cylc.rc
  • conf.rc
  • config.rc
  • settings.rc
Was this page helpful?
0 / 5 - 0 ratings

Related issues

oliver-sanders picture oliver-sanders  Â·  4Comments

dpmatthews picture dpmatthews  Â·  3Comments

kinow picture kinow  Â·  4Comments

hjoliver picture hjoliver  Â·  5Comments

kinow picture kinow  Â·  3Comments