Api
- class composapy.dataflow.api.DataFlow
DataFlow static wrapper for the ApplicationService contract. It is used to service user-level operations on an application-level library.
from composapy.dataflow.api import DataFlow
- static create(json: str = None, file_path: str = None) DataFlowObject
Takes a json formatted string or a local file path containing a valid json (supplying arguments to both will raise exception). Imports the dataflow using the dataflow service binding, and returns a DataFlowObject. Note that creating does not save the dataflow, the .save() method must be called on DataFlowObject to save it in your Composable database.
dataflow_object = DataFlow.create(file_path="simple-dataflow.json")
- Parameters:
json – a json-formatted string
file_path – path to json-formatted file
- Returns:
the unsaved Application contract wrapped in a DataFlowObject
- static get(dataflow_id: int) DataFlowObject
Returns the wrapped Application contract inside a DataFlowObject.
dataflow_object = DataFlow.get(123456)
- Parameters:
dataflow_id – a valid(saved) Composable dataflow id
- Returns:
the Application contract wrapped in a DataFlowObject
- static get_run(run_id: int) DataFlowRun
dataflow_run = DataFlow.get_run(654321)
- Parameters:
run_id – Composable dataflow run id
- Returns:
the wrapped ExecutionState contract inside a DataFlowRun
- static run(dataflow_id: int, external_inputs: Dict[str, any] = None) DataFlowRun | None
Runs a dataflow from the dataflow id (an invalid id will cause this method to return None). Any external modules (external int, table, file) that require outside input to run can be added using a dictionary with the module input’s name and corresponding contract.
dataflow_run = DataFlow.run(123456) dataflow_run = DataFlow.run(123456, external_inputs={"external_int_input_name": 3})
- Parameters:
dataflow_id – a valid(saved) Composable dataflow id
external_inputs – If there are any external inputs in the DataFlow, you can supply them via external_inputs[“key”] = value. It takes the external input name as a key and the external input value as value. You can find more about external input modules here.
- Returns:
the wrapped ExecutionState contract inside a DataFlowRun
- static run_status(run_id: int)
Retrieves run status.
- Parameters:
run_id – Composable dataflow run id
- static wait_for_run_execution(run_id: int) Dict[str, int]
Waits until run has finished. Returns a dict with keys “execution_status” and “run_id”.
- Parameters:
run_id – Composable dataflow run id
- Returns:
status of the execution, ExecutionStatus