Flows Manager
Below is the class Gladier uses to track local changes to flows.
- class gladier.FlowsManager(flow_id: ~typing.Optional[str] = None, flow_definition: ~typing.Optional[dict] = None, flow_schema: ~typing.Optional[dict] = None, flow_title: ~typing.Optional[str] = None, globus_group: ~typing.Optional[str] = None, on_change: ~typing.Optional[~typing.Callable] = <function ensure_flow_registered>, redeploy_on_404: bool = True, **kwargs)
Bases:
ServiceManager
The flows manager tracks an externally defined flow_definition and ensures it stays up-to-date with a deployment in the flows service. It can be run without a flow_id in which case it will deploy its own flow if a stored flow_id does not exist.
The flow checksum is evaluated inside
run_flow()
, and any updates to the flow will take place before the flow is started. The registration behavior can be customized by passing in a function foron_change
. Default behavior will callregister_flow()
, None will disable changing the flow before starting it. Theon_change
signature is below:def on_change_callback(flows_manager_instance: FlowsManager, exc: gladier.exc.RegistrationException) -> None:
- Parameters:
flow_id – Explicit flow id to use. None will result in deploying a new flow
flow_definition – Flow definiton that should be used. Usually set dynamically at runtime when used with a Gladier Client
flow_schema – The schema to be used alongside the flow definition
flow_title – The title for the Globus Flow
globus_group – A Globus Group UUID. Used to grant all flow and run permissions
on_change – callback on checksum mismatch or missing flow id. Default registers/deploys flow,
None
takes no action and attempts to run “obselete” flows.redeploy_on_404 – Deploy a new flow if attempting to run the current flow ID results in 404. Behavior is disabled if an explicit flow_id is specified.
When used with a Gladier Client, following items will be auto-configured and should not be set explicitly in the constructor:
flow_definition
flow_schema
Note
The FlowsManager class cannot be used to run flows outside of Gladier Clients due to internal class storage requirements. Doing so will result in an exception.
- get_flow_id() Optional[str]
Return flow id. If an ID was set on this class in the constructor, that is used. Otherwise, a retrieve from storage is attempted with ‘flow_id’ if a flow has been run before and a local id is cached in storage. If no flow_id exists from either of these locations, None is returned instead.
- Returns:
flow_id uuid for deployed flow, or None if it does not exist