Process Instance¶
This module provides access to the process instance REST api of Camunda.
ProcessInstance¶
-
class
pycamunda.processinst.
ProcessInstance
(id_: str, definition_id: str, business_key: str, case_instance_id: str, tenant_id: str, suspended: bool, links: Tuple[pycamunda.resource.Link], variables: Optional[Dict[str, pycamunda.variable.Variable]] = None)¶ Data class of process instance as returned by the REST api of Camunda.
-
variables
= None¶
-
Delete¶
-
class
pycamunda.processinst.
Delete
(url: str, id_: str, skip_custom_listeners: bool = False, skip_io_mappings: bool = False, skip_subprocesses: bool = False, fail_if_not_exists: bool = True)¶ Delete a process instance.
Parameters: - url – Camunda Rest engine URL.
- id – Id of the process instance.
- skip_custom_listeners – Whether to skip custom listeners and notify only builtin ones.
- skip_io_mappings – Whether to skip input/output mappings.
- skip_subprocesses – Whether to skip subprocesses.
- fail_if_not_exists – Whether to fail if the provided process instance id is not found.
-
__call__
(*args, **kwargs)¶ Send the request.
GetActivityInstance¶
GetList¶
-
class
pycamunda.processinst.
GetList
(url: str, process_instance_ids: Optional[Iterable[str]] = None, business_key: Optional[str] = None, business_key_like: Optional[str] = None, case_instance_id: Optional[str] = None, process_definition_id: Optional[str] = None, process_definition_key: Optional[str] = None, process_definition_key_in: Optional[Iterable[str]] = None, process_definition_key_not_in: Optional[Iterable[str]] = None, deployment_id: Optional[str] = None, super_process_instance: Optional[str] = None, sub_process_instance: Optional[str] = None, super_case_instance_id: Optional[str] = None, sub_case_instance_id: Optional[str] = None, active: bool = False, suspended: bool = False, with_incident: Optional[bool] = None, incident_id: Optional[str] = None, incident_type: Union[str, pycamunda.incident.IncidentType, None] = None, incident_message: Optional[str] = None, incident_message_like: Optional[str] = None, tenant_id_in: Optional[Iterable[str]] = None, without_tenant_id: bool = False, activity_id_in: Optional[Iterable[str]] = None, root_process_instances: Optional[bool] = None, leaf_process_instances: Optional[bool] = None, process_definition_without_tenant_id_in: Optional[bool] = None, variables=None, variable_names_ignore_case: Optional[bool] = None, variable_values_ignore_case: Optional[bool] = None, sort_by: Optional[str] = None, ascending: bool = True, first_result: Optional[int] = None, max_results: Optional[int] = None)¶ Get a list of process instances.
Parameters: - url – Camunda Rest engine URL.
- process_instance_ids – Filter by process instance ids.
- business_key – Filter by business key.
- business_key_like – Filter by a substring of the business key.
- case_instance_id – Filter by case instance id.
- process_definition_id – Filter by process definition id.
- process_definition_key – Filter by process definition key.
- process_definition_key_in – Filter whether the process definition key is one of multiple ones.
- process_definition_key_not_in – Filter whether the process definition key is not one of multiple ones.
- deployment_id – Filter by deployment id.
- super_process_instance – Filter process instances that are a sub process of the provided id.
- sub_process_instance – Filter process instances that are a super process of the provided id.
- super_case_instance_id – Filter process instances that are a sub process of the provided case instance id.
- sub_case_instance_id – Filter process instances that are a super process of the provided case instance id.
- active – Whether to include only active process instances.
- suspended – Whether to include only suspended process instances.
- with_incident – Whether to include only process instances that have incidents.
- incident_id – Filter by incident id.
- incident_type – Filter by incident type.
- incident_message – Filter by the incident message.
- incident_message_like – Filter by a substring the incident message.
- tenant_id_in – Filter whether the tenant id is one of multiple ones.
- without_tenant_id – Whether to include only process instances that belong to no tenant.
- activity_id_in – Filter whether the activity id is one of multiple ones.
- root_process_instances – Include only top level process instances.
- leaf_process_instances – Include only bottom level process instances.
- process_definition_without_tenant_id_in – Include only process instance where the process definition has no tenant id.
- variables – # TODO (add via its own method?)
- variable_names_ignore_case – Whether to ignore case sensitivity for variables names.
- variable_values_ignore_case – Whether to ignore case sensitivity for variable values.
- sort_by – Sort the results by ‘instance_id’, ‘definition_key’, ‘definition_id’, ‘tenant_id’, ‘business_key’.
- ascending – Sort order.
- first_result – Pagination of results. Index of the first result to return.
- max_results – Pagination of results. Maximum number of results to return.
-
__call__
(*args, **kwargs) → Tuple[pycamunda.processinst.ProcessInstance]¶ Send the request.
Get¶
Modify¶
-
class
pycamunda.processinst.
Modify
(url: str, id_: str, async_: bool = False, skip_custom_listeners: bool = False, skip_io_mappings: bool = False, annotation: Optional[str] = None)¶ Modify a running process instance. This is done by adding instructions that are executed on a process instance.
Parameters: - url – Camunda Rest engine URL.
- id – Id of the process instance.
- async – Whether to run this request asynchronously.
- skip_custom_listeners – Whether to skip custom listeners and notify only builtin ones.
- skip_io_mappings – Whether to skip input/output mappings.
- annotation – Arbitrary text annotation for auditing reasons.
-
__call__
(*args, **kwargs) → Optional[pycamunda.batch.Batch]¶ Send the request.
-
add_after_activity_instruction
(id_: str, variables: Optional[Mapping[str, pycamunda.variable.Variable]] = None) → None¶ Add an instruction to start execution at the single outgoing sequence flow of an activity.
Parameters: - id – Id of the activity.
- variables – Mapping from names to the corresponding variables.
-
add_before_activity_instruction
(id_: str, variables: Optional[Mapping[str, pycamunda.variable.Variable]] = None) → None¶ Add an instruction to start execution before a given activity is entered.
Parameters: - id – Id of the activity.
- variables – Mapping from names to the corresponding variables.
-
add_cancel_activity_instance_instruction
(id_) → None¶ Add an instruction to cancel an activity instance.
Parameters: id – Id of the activity.
-
add_cancel_activity_instruction
(id_) → None¶ Add an instruction to cancel an activity.
Parameters: id – Id of the activity.
-
add_cancel_ancestor_activity_instance_instruction
(id_: str) → None¶ Add an instruction to cancel an ancestor activity instance.
Parameters: id – Id of the ancestor activity instance.
-
add_cancel_transition_instance_instruction
(id_) → None¶ Add an instruction to cancel an activity instance.
Parameters: id – Id of the transition instance.
-
add_start_after_ancestor_activity_instance_instruction
(id_: str, variables: Optional[Mapping[str, pycamunda.variable.Variable]] = None) → None¶ Add an instruction to start execution at the single outgoing sequence flow of an ancestor activity instance.
Parameters: - id – Id of the ancestor activity instance.
- variables – Mapping from names to the corresponding variables.
-
add_start_before_ancestor_activity_instance_instruction
(id_: str, variables: Optional[Mapping[str, pycamunda.variable.Variable]] = None) → None¶ Add an instruction to start execution before a given ancestor activity instance is entered.
Parameters: - id – Id of the ancestor activity instance.
- variables – Mapping from names to the corresponding variables.
-
add_transition_instruction
(id_, variables: Optional[Mapping[str, pycamunda.variable.Variable]] = None) → None¶ Add an instruction to start execution at the single outgoing sequence flow of an activity.
Parameters: - id – Id of the sequence flow to start.
- variables – Mapping from names to the corresponding variables.
Activate¶
Suspend¶
VariablesDelete¶
-
class
pycamunda.processinst.
VariablesDelete
(url: str, process_instance_id: str, var_name: str)¶ Delete a process instance variable.
Parameters: - url – Camunda Rest engine URL.
- process_instance_id – Id of the process instance.
- var_name – Name of the variable.
-
__call__
(*args, **kwargs) → None¶ Send the request.
VariablesGet¶
-
class
pycamunda.processinst.
VariablesGet
(url: str, process_instance_id: str, var_name: str, deserialize_value: bool = False, binary: bool = False)¶ Get a variable of a process instance.
Parameters: - url – Camunda Rest engine URL.
- process_instance_id – Id of the process instance.
- var_name – Name of the variable.
- deserialize_value – Whether serializable variable values are deserialized on server side.
- binary – Whether the requested variable is a binary array or file variable.
-
__call__
(*args, **kwargs) → Union[pycamunda.variable.Variable, bytes]¶ Send the request.
VariablesGetList¶
-
class
pycamunda.processinst.
VariablesGetList
(url: str, process_instance_id: str, deserialize_values: bool = False)¶ Get variables of a process instance.
Parameters: - url – Camunda Rest engine URL.
- process_instance_id – Id of the process instance.
- deserialize_values – Whether serializable variable values are deserialized on server side.
-
__call__
(*args, **kwargs) → Dict[str, pycamunda.variable.Variable]¶ Send the request.
VariablesModify¶
-
class
pycamunda.processinst.
VariablesModify
(url: str, process_instance_id: str, deletions: Optional[Iterable[str]] = None)¶ Modify variables of a process instance. This can be either updating or deleting variables.
Parameters: - url – Camunda Rest engine URL.
- process_instance_id – Id of the process instance.
- deletions – Variables to delete.
-
__call__
(*args, **kwargs) → None¶ Send the request.
-
add_variable
(name: str, value: Any, type_: Optional[str] = None, value_info: Optional[Any] = None) → None¶ Add a variable to modify.
Parameters: - name – Name of the variable.
- value – Value of the variable.
- type – Value type of the variable.
- value_info – Additional information regarding the value type.
VariablesUpdate¶
-
class
pycamunda.processinst.
VariablesUpdate
(url: str, process_instance_id: str, var_name: str, value: Any, type_: Optional[str] = None, value_info: Optional[Any] = None)¶ Update a process instance variable. May be used with binary and file variables.
Parameters: - url – Camunda Rest engine URL.
- process_instance_id – Id of the process instance.
- var_name – Name of the variable.
- value – Value of the variable.
- type – Value type of the variable. To send binary variables use the value ‘Bytes’ and to send the binary value of a file variable use the value ‘File’ for this parameter.
- value_info – Additional information regarding the value type. Ignored if ‘type_’ is ‘Bytes’ or ‘File’.
-
__call__
(*args, **kwargs) → None¶ Send the request.