Project

General

Profile

Actions

Refactor #27410

closed

Avoid using internal world.clock within workers

Added by Ivan Necas over 5 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Dynflow
Target version:
Fixed in Releases:
Found in Releases:

Description

Withing https://projects.theforeman.org/issues/27409, the worker's clock object is used for scheduling the future events that are initiated from within of actions (polling is a typical example https://github.com/Dynflow/dynflow/blob/master/lib/dynflow/action/polling.rb#L93).

Given this introduced additional state that worker needs preserve, it goes against the idea of the worker being as stateless as possible. Therefore, a better way would be getting the information about the future events to the orchestrator, that would use it's own clock for emitting them. A possible channel for this data would be the OrchestratorJobs::WorkerDone job

It will be probably necessary to still use the world.clock in worker for some other cases (the one I can thing of is the heartbeat).

There are multiple possible ways to achieve this. One goal in mind would be to preserve the backward compatibility with existing actions, to avoid upgrade issues.

The options I can think of are:

- Modifying the world.clock to be able to collect the information about future events regarding specific actions, while the other uses of clock would use world.internal_clock instead
- Teaching the clock the fact, that when the a SuspendedAction is the `who` in ping method https://github.com/Dynflow/dynflow/blob/master/lib/dynflow/clock.rb#L134, it should just collect this info, that would be then sent do the orchestrator. The rest of clock semantics might stay unchanged.

Although we might intoroduce the `clock` as the action property, and keep the data in the context of action during the run, in order to preserve the backward compatibility, I'm afraid we will not be ale to avoid Thread[:current] structure to collect the action-specific clock events.


Related issues 1 (0 open1 closed)

Blocks foreman-tasks - Tracker #27408: Dynflow workers extraction to separate processesClosed

Actions
Actions #1

Updated by Ivan Necas over 5 years ago

  • Blocks Tracker #27408: Dynflow workers extraction to separate processes added
Actions #2

Updated by Adam Ruzicka over 5 years ago

  • Category set to Dynflow
  • Pull request https://github.com/Dynflow/dynflow/pull/332 added
Actions #3

Updated by Adam Ruzicka over 5 years ago

  • Status changed from New to Ready For Testing
Actions #4

Updated by Adam Ruzicka over 5 years ago

  • Target version set to dynflow-1.4.0
Actions #5

Updated by Adam Ruzicka about 5 years ago

  • Status changed from Ready For Testing to Closed
Actions #6

Updated by Adam Ruzicka about 5 years ago

  • Status changed from Closed to Ready For Testing
  • Pull request https://github.com/Dynflow/dynflow/pull/344 added
Actions #7

Updated by Adam Ruzicka about 3 years ago

  • Status changed from Ready For Testing to Closed

Linked PRs are closed, closing.

Actions

Also available in: Atom PDF