StepRunner
This is a description of the StepRunner
class. It is intended to be used as a container and runner for all ETL DataRailsStep child classes.
Steps are run in the order they are added to the runner. The constructor take a list of step class definitions.
A DataBox will be created automatically in the constructor and passed to each step as the execution progresses.
To use this class
from datarails.runner import DataRailsStepRunner
This class orchestrates the execution of a sequence of DataRailsSteps. It primarily uses DataBox as input, advancing through the steps and managing the DataBox state.
Attributes:
Name | Type | Description |
---|---|---|
steps |
List[Type[DataRailsStep]]
|
The ordered list of step classes to be executed. |
dbx |
DataBox
|
The DataBox object for data management. |
ctx |
DataRailsContext
|
The DataRailsContext object for context management. |
Source code in datarails/runner.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
__init__(steps, dbx=None, ctx=None)
Initializes the StepRunner object with a list of DataRailsStep classes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
steps |
List[Type[DataRailsStep]]
|
The list of step classes to be executed. |
required |
dbx |
DataBox
|
The DataBox object. If not provided, a new one is created. |
None
|
ctx |
DataRailsContext
|
The DataRailsContext object. If not provided, a new one is created. |
None
|
Source code in datarails/runner.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
advance()
Executes the current step in the steps list and advances the index to the next one. Prints a message if there are no more steps to execute.
Source code in datarails/runner.py
65 66 67 68 69 70 71 72 73 74 75 76 |
|
get_current_step()
Retrieves the current step instance based on the index.
Returns:
Name | Type | Description |
---|---|---|
DataRailsStep |
The current step instance. |
Source code in datarails/runner.py
49 50 51 52 53 54 55 56 |
|
print_current_step()
Prints the details of the current step to standard output.
Source code in datarails/runner.py
58 59 60 61 62 63 |
|
reset()
Resets the steps_iterator to its initial state, enabling the step sequence to be run again from the start.
Source code in datarails/runner.py
34 35 36 37 38 |
|
run()
Executes all steps in the steps list. If all steps have been completed, it stops the execution.
Source code in datarails/runner.py
78 79 80 81 82 83 |
|