-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoy2_run.py
41 lines (32 loc) · 959 Bytes
/
toy2_run.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
"""
For this to work, you need to add this fix: https://github.com/DAGWorks-Inc/hamilton/pull/545/files#diff-36163122fda0a94ce7ce6d134ce42cb88f35682c8027ef1d8cded4ae6a3dc238R269
"""
import pandas as pd
import toy2_nodes
from hamilton import driver, base, telemetry
from hamilton.execution import executors
telemetry.disable_telemetry()
config = {}
dr = (
driver.Builder()
.with_modules(toy2_nodes)
.enable_dynamic_execution(allow_experimental_mode=True)
.with_local_executor(executors.SynchronousLocalTaskExecutor())
.with_config(config)
.build()
)
dr.list_available_variables()
output_columns = [
'data_agg1',
'data_agg2',
'output_agg1',
'output_agg2',
]
out = dr.execute(output_columns)
print(out)
if False:
# print for testing
list(out['data_agg1'])
list(out['data_agg2'])
cache_file = '/home/user/hamilton_test.dot'
dr.visualize_execution(output_columns, cache_file, {'format': 'png'})