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

reload the global configuration during a workflow run #3762

Open
oliver-sanders opened this issue Aug 7, 2020 · 6 comments · May be fixed by #6509
Open

reload the global configuration during a workflow run #3762

oliver-sanders opened this issue Aug 7, 2020 · 6 comments · May be fixed by #6509
Milestone

Comments

@oliver-sanders
Copy link
Member

oliver-sanders commented Aug 7, 2020

[edit] This issue was re-written to broaden its scope from a main-loop plugin to also cover workflow config reload.

At present the global config is static. It is read in once when the scheduler starts.

There may be use cases for "reloading" the global configuration (not to be mistaken for the workflow config) while the workflow is running, e.g:

  • Dynamic run hosts to support elastically scaling Cylc server clusters.
  • Dynamic platforms to allow admins to update platform configs on-the-fly.
  • Discourse post.

There is one part of Cylc which is already reloading the global config, the auto-restart main-loop plugin. This plugin "re"loads the global config periodically in order to check the [run hosts]available and [run hosts]condemned settings. These settings are used to control the auto-restart functionality. However, this "refreshing" is constrained to the auto-restart plugin, it does not affect the cached instance that is used elsewhere throughout the Cylc codebase.

The "refreshing" of the global config could occur:

  • Periodically (e.g. with a main loop plugin).
  • On demand, with workflow config reload.
  • [HO] On demand, separately from workflow config reload
    (workflow config reload can be intensive, and may not be needed along with a global reload)

This should be technically simple to accomplish, however, there is a high potential for caveats / inconsistencies with different parts of the system working with different versions of the config:

  • Make sure code isn't caching values from glbl_cfg() calls.
  • Clear and rebuild any state which is derived from configs pull in from the global config.
  • There are some configs that we will not be able "refresh" in this way, e.g. [symlink dirs] or UTC mode. We need to ensure these configs remain cached.

We will need to define the scope of this feature (i.e. what things can or can not be changed by global config reload), and communicate this somehow. I.e, we should add a note to global config entries to mark them as reloadable or not.

Pull requests welcome!

@oliver-sanders oliver-sanders added this to the cylc-8.0.0 milestone Aug 7, 2020
@oliver-sanders oliver-sanders added the question Flag this as a question for the next Cylc project meeting. label Aug 7, 2020
@hjoliver
Copy link
Member

hjoliver commented Aug 7, 2020

Should this plugin be included in the default set, if so with what interval.

IMO yes it should. Infrequent - 10 min?

@oliver-sanders
Copy link
Member Author

Note: with #5182 platforms are cached so this plugin will need to wipe the cache for changes to get picked up.

@oliver-sanders oliver-sanders changed the title main loop: plugin to reload the global configuration reload the global configuration during a workflow run Nov 26, 2024
@ScottWales
Copy link
Contributor

I'll take a look at this

@hjoliver
Copy link
Member

hjoliver commented Dec 2, 2024

Note, I added a bullet point to the description above:

[HO] On demand, separately from workflow config reload
(workflow config reload can be intensive, and may not be needed along with a global reload)

@ScottWales
Copy link
Contributor

Config items that have a persistent effect are mainly under [scheduler] and would be simplest to handle by requiring restarting the server to change:

Install paths for a platform have a persistent effect on the filesystem, changing them after the platform has been created is not going to have any effect (even if the server is stopped and restarted)

Platforms are attached to task proxies rather than individual jobs. Currently the original platform attached to a task proxy persists through reloads. Changing the platform of a running job could break things, e.g. changing the host of a background task, but other modifications might want to affect existing jobs, e.g. changing the global init-script and retrying a failed job.

I'm not sure if the global and workflow reloads can be easily separated - if the global reload affects platforms then the task proxies need to be re-created - is that what takes up all the time for a workflow reload? Or is there a separate costly step?

All the other glbl_cfg() references I could find appear to be restricted to inside a function where just changing the global config object is sufficient.

@hjoliver
Copy link
Member

hjoliver commented Dec 3, 2024

I'm not sure if the global and workflow reloads can be easily separated -

If that's the case, I think it's fine to do both at once, at least as a first cut (and maybe for the long run, given your next point).

if the global reload affects platforms then the task proxies need to be re-created - is that what takes up all the time for a workflow reload?

That's a good point. Yes I think recreating all the task proxies is the main sink for reload time. Maybe it doesn't matter too much anymore though. In Cylc 7 there were typical way more task proxies in a large workflow, than in Cylc 8 (which has just the "active window" tasks).

@ScottWales ScottWales linked a pull request Dec 3, 2024 that will close this issue
8 tasks
@oliver-sanders oliver-sanders removed the question Flag this as a question for the next Cylc project meeting. label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants