graviti.manager.action#

The implementation of the Action and ActionManager.

Module Contents#

Classes#

Action

This class defines the structure of an action.

ActionManager

This class defines the operations on the action in Graviti.

Run

This class defines the structure of an action run.

RunManager

This class defines the operations on the action run in Graviti.

Node

This class defines the structure of a node of action run.

class graviti.manager.action.Action(dataset, response)[source]#

Bases: graviti.utility.ReprMixin

This class defines the structure of an action.

Parameters
  • dataset (graviti.manager.dataset.Dataset) – Class Dataset instance.

  • response (Dict[str, Any]) –

    The response of the OpenAPI associated with the action:

    {
        "id": <str>,
        "name": <str>,
        "edition": <int>,
        "state": <str>,
        "payload": <str>,
    },
    

name#

The name of this action.

edition#

The edition of this action.

state#

The state of this action.

payload#

The payload of this action.

property runs(self)[source]#

Get class RunManager instance.

Returns

Required RunManager instance.

Return type

RunManager

edit(self, *, name=None, payload=None)[source]#

Update the action.

Parameters
  • name (Optional[str]) – The new name of the action.

  • payload (Optional[str]) – The new paylaod of the action.

Return type

None

enable(self)[source]#

Enable the action.

Return type

None

disable(self)[source]#

Disable the action.

Return type

None

class graviti.manager.action.ActionManager(dataset)[source]#

This class defines the operations on the action in Graviti.

Parameters

dataset (graviti.manager.dataset.Dataset) – Dataset instance.

create(self, name, payload)[source]#

Create an action.

Parameters
  • name (str) – The name of the action.

  • payload (str) – The payload of the action.

Returns

The Action instance with the given name.

Return type

Action

get(self, name)[source]#

Get the action with the given name.

Parameters

name (str) – The required action name.

Raises

ResourceNameError – When the given name is an empty string.

Returns

The Action instance with the given name.

Return type

Action

list(self, *, sort=None)[source]#

List the information of actions.

Parameters

sort (graviti.utility.SortParam) – The column and the direction the list result sorted by.

Returns

The LazyPagingList of actions instances.

Return type

graviti.manager.lazy.LazyPagingList[Action]

delete(self, name)[source]#

Delete an action.

Parameters

name (str) – The name of the action to be deleted.

Raises

ResourceNameError – When the given name is an empty string.

Return type

None

class graviti.manager.action.Run(action, response)[source]#

Bases: graviti.utility.ReprMixin

This class defines the structure of an action run.

Parameters
  • action (Action) – Class Action instance.

  • response (Dict[str, Any]) –

    The response of the OpenAPI associated with the action run:

    {
        "id": <str>,
        "number": <int>,
        "name": <str>,
        "workflow_id": <str>,
        "status": <int>,
        "arguments": <dict>,
        "started_at": <str>,
        "ended_at": <str>,
    },
    

number#

The number of this action run.

name#

The name of this action run.

status#

The status of this action run.

arguments#

The arguments of this action run.

started_at#

The start time of this action run.

ended_at#

The end time of this action run.

duration#

The duration of this action run.

nodes(self)[source]#

Get the nodes of the action run.

Returns

The nodes of the action run.

Return type

List[Node]

property url(self)[source]#

Get the url of the action run.

Returns

The url of the action run.

Raises

ValueError – When the access key format is wrong.

Return type

str

cancel(self)[source]#

Cancel the action run.

Return type

None

class graviti.manager.action.RunManager(action)[source]#

This class defines the operations on the action run in Graviti.

Parameters

action (Action) – Action instance.

create(self, arguments=None)[source]#

Run an action manually.

Parameters

arguments (Optional[Dict[str, Any]]) – The arguments of the action run.

Returns

The Run instance with the given arguments.

Return type

Run

get(self, run_number)[source]#

Get the action with the given name.

Parameters

run_number (int) – The number of the action run.

Returns

The Action instance with the given name.

Return type

Run

list(self, *, sort=None)[source]#

List the information of action runs.

Parameters

sort (graviti.utility.SortParam) – The column and the direction the list result sorted by.

Returns

The LazyPagingList of runs instances.

Return type

graviti.manager.lazy.LazyPagingList[Run]

class graviti.manager.action.Node(run, response)[source]#

Bases: graviti.utility.ReprMixin

This class defines the structure of a node of action run.

Parameters
  • run (Run) – Class Run instance.

  • response (Dict[str, Any]) –

    The response of the OpenAPI associated with the action run node:

    {
        "id": <str>,
        "name": <str>,
        "display_name": <str>,
        "phase": <str>,
        "started_at": <str>,
        "ended_at": <str>,
        "children": <list[str]>,
    },
    

node_id#

The id of this action run node.

name#

The name of this action run node.

display_name#

The display name of this action run node.

phase#

The phase of this action run node.

started_at#

The start time of this action run node.

ended_at#

The end time of this action run node.

duration#

The duration of this action run node.

children#

The children of this action run node.