-
Notifications
You must be signed in to change notification settings - Fork 2
/
step_execution.py
51 lines (40 loc) · 1.85 KB
/
step_execution.py
1
2
3
4
5
6
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
from mlspeclib import MLObject
from pathlib import Path
import sys
sys.path.append(str(Path.cwd().parent))
from utils.utils import setupLogger # noqa
# Making this a class in case we want sub functions.
class StepExecution:
input_params = {} # noqa
execution_params = {} # noqa
ml_object = MLObject() # noqa
rootLogger = None # noqa
def __init__(self, input_params, execution_params):
self.input_params = input_params
self.execution_params = execution_params
self.rootLogger = setupLogger().get_root_logger()
# Execute all work in here.
# Output input params & execution params
if self.input_params is not None:
self.rootLogger.debug(f"Input params: {self.input_params}")
if self.execution_params is not None:
self.rootLogger.debug(f"Execution params: {self.execution_params}")
def execute(self, result_object_schema_type, result_object_schema_version):
# Create Result object
results_object = MLObject()
results_object.set_type(
schema_type=result_object_schema_type,
schema_version=result_object_schema_version,
)
# Mocked up results
return_dict = {
"data_output_path": str(Path("tests/data/data_output.csv")),
"data_statistics_path": str(Path("tests/data/data_stats.csv")),
"data_schemas_path": str(Path("tests/data/data_schemas.yaml")),
"feature_file_path": str(Path("tests/data/feature_file.yaml")),
}
results_object.data_output_path = return_dict["data_output_path"]
results_object.data_statistics_path = return_dict["data_statistics_path"]
results_object.data_schemas_path = return_dict["data_schemas_path"]
results_object.feature_file_path = return_dict["feature_file_path"]
return results_object