step¶
- class virtualitics_sdk.flow.step.Step(title, description, parent, type, page, allow_filters=False, uses_pyspark=False, uses_pyvip=False, uses_snowflake=False, overrides_action=False, await_actions=True, override_skips_default=False, alerts=None, **kwargs)¶
Bases:
ABC
A Step is the basic unit of an app. Steps can be chained together to form an app.
- Parameters:
title (
str
) – The title of the step.description (
str
) – A description of what the step does.parent (
str
) – The parent step.type (
StepType
) – The Step type.page (
Page
) – The initial Page for this step.uses_pyspark (
bool
) – Whether or not the step uses PySpark, defaults to False.uses_pyvip (
bool
) – Whether or not the step requires a pyVIP connection, defaults to False.uses_snowflake (
bool
) – Whether or not the step requires a Snowflake connection, defaults to False.overrides_action (
bool
) – Whether this step overrides the default action for this step type, defaults to False.await_actions (
bool
) – whether this step overrides must wait for an action to continue to the next page, defaults to True.override_skips_default (
bool
) – When true and overrides_action is true, this flag defines whether to skip over the default step action, defaults to False.alerts (
Optional
[List
]) – The Alerts for this Step. This feature is currently unimplemented, defaults to None.
- Raises:
PredictException – Raises an error if the character ‘/’ is found in the flow title.
- action_override(flow_metadata)¶
This method is similar to
run
, but is not mandatory to implement in a given Step. It allows for the customization or bypassing of default step actions.Typically, when a step runs, all code in the run method executes before the page is generated, and upon clicking the “Next” button, the step action executes to clean up and prepare for the next step. This method is useful for scenarios where the default action, such as processing a .csv file into a Pandas DataFrame, needs to be customized or skipped entirely.
Overriding this method in a step will run this function after the step has been completed. To make sure this runs, set overrides_action to True. If you want to skip the default behavior for an action (i.e. for custom data processing of an input file), set override_skips_default to True as well.
- Parameters:
flow_metadata (
FlowMetadata
) – Relevant information about the current step which is useful to access theStoreInterface
EXAMPLE:
# Imports from virtualitics_sdk import Step ... # Example usage class DataUpload(Step): def run(self, flow_metadata): pass def action_override(self, flow_metadata): query_id = store_interface.get_element_value(data_upload_step.name, "Query Selection") query = QUERY_SELECTION.get(query_id) df = store_interface.db_to_pandas(query, conn_name='shotlogs') store_interface.save_output(df, DATA_LINK)
- copy()¶
- property message¶
- on_action_success(store_interface, *args, **kwargs)¶
- on_run_success(store_interface, *args, **kwargs)¶
- property progress¶
- progress_update(progress, message)¶
- abstract run(flow_metadata, spark_session=None, pyvip_client=None)¶
- class virtualitics_sdk.flow.step.StepType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
The type of Step being created. INPUT: A Step should be of type input if it contains input elements. DASHBOARD: Marking steps as Dashboard Steps helps them be easily found in the Dashboards section. RESULTS: If a step contains neither inputs or dashboards it should be a Results step.
- DASHBOARD = 3¶
- DATA_LAB = 1¶
- INPUT = 0¶
- RESULTS = 2¶