SDK Reference

class gladier.client.GladierBaseClient(authorizers=None, auto_login=True, auto_registration=True)

Bases: object

The Gladier Client ties together commonly used funcx functions and basic flows with auto-registration tools to make complex tasks easy to automate.

Default options are intended for CLI usage and maximum user convenience.

Parameters
  • authorizers – Provide live globus_sdk authorizers with a dict keyed by scope.

  • auto_login – Automatically trigger login() calls when needed. Should not be used with authorizers.

  • auto_registration – Automatically register functions or flows if they are not previously registered or obsolete.

Raises

gladier.exc.AuthException – if authorizers given are insufficient

login(**login_kwargs)

Login to the Gladier client. This will ensure the user has the correct tokens configured but it DOES NOT guarantee they are in the correct group to run a flow. Can be run both locally and on a server. See help(fair_research_login.NativeClient.login) for a full list of kwargs.

logout()

Log out and revoke this client’s tokens. This object will no longer be usable until a new login is called.

get_input()

Get funcx function ids, funcx endpoints, and each tool’s default input. Default input may not be enough to run the flow. For example if a tool does processing on a local filesystem, the file will always need to be provided by the user when calling run_flow().

Defaults rely on GladierBaseTool.flow_input defined separately for each tool.

Returns

input for a flow wrapped in an ‘input’ dict. For example: {‘input’: {‘foo’: ‘bar’}}

run_flow(flow_input=None, use_defaults=True, **flow_kwargs)

Start a Globus Automate flow. Flows and Functions must be registered prior or self.auto_registration must be True.

If auto-registering a flow and self.auto_login is True, this may result in two logins. The first is for authorizing basic tooling, and the second is to autorize the newly registered automate flow.

Parameters
  • flow_input – A dict of input to be passed to the automate flow. self.check_input() is called on each tool to ensure basic needs are met for each. Input MUST be wrapped inside an ‘input’ dict, for example {‘input’: {‘foo’: ‘bar’}}.

  • use_defaults – Use the result of self.get_input() to populate base input for the flow. All conflicting input provided by flow_input overrides values set in use_defaults.

  • **flow_kwargs – Set several keyed arguments that include the label to be used in the automate app. If no label is passed the standard automate label is used. Also ensure label <= 64 chars long.

Raise

gladier.exc.ConfigException by self.check_input()

Raises

gladier.exc.FlowObsolete

Raises

gladier.exc.NoFlowRegistered

Raises

gladier.exc.RegistrationException

Raises

gladier.exc.FunctionObsolete

Raises

gladier.exc.AuthException

Raises

Any globus_sdk.exc.BaseException

get_status(action_id)

Get the current status of the automate flow. Attempts to do additional work on funcx functions to deserialize any exception output.

Parameters

action_id – The globus action UUID used for this flow. The Automate flow id is always the flow_id configured for this tool.

Raises

Globus Automate exceptions from self.flows_client.flow_action_status

Returns

a Globus Automate status object (with varying state structures)

progress(action_id, callback=None)

Continuously call self.get_status() until the flow completes. Each status response is used as a parameter to the provided callback, by default will use the builtin callback to print the current state to stdout.

Parameters
  • action_id – The action id for a running flow. The flow is automatically pulled based on the current tool’s flow_definition.

  • callback – The function to call with the result from self.get_status. Must take a single parameter: mycallback(self.get_status())