Roy Kid
03/27/2024, 12:44 PMto.pickle
. I found the materilizer already added into graph, but it can not get node.version
. The materializer's version is None, so it can not be sorted. Here is a snapshot:Elijah Ben Izzy
03/27/2024, 3:06 PMRoy Kid
03/27/2024, 3:08 PMElijah Ben Izzy
03/27/2024, 3:09 PMRoy Kid
03/27/2024, 3:09 PMElijah Ben Izzy
03/27/2024, 3:09 PMThierry Jean
03/27/2024, 3:17 PMHamiltonNode.version
• the new versioning API was designed and tested in the context of the CLI, which doesn't have to deal with materializers
The bug raises some design questions (for version, experiment tracking, and caching):
• HamiltonNode.version
contains information about code version
• a materializer has a code version based on it's class (instead of a function)
• does it make sense to version the data of a materializer? after all, if someone calls for a materializer, they probably expect results to be materializedRoy Kid
03/27/2024, 6:31 PMMaterializer dependency [..., n_chains: int, ...] is not a string, a function, or a driver.Variable.
Thierry Jean
03/27/2024, 6:34 PM.materialize()
, we're currently implementing a fix! Regarding this other error message, you're getting this when calling .execute()
?Roy Kid
03/27/2024, 6:35 PM.execute()
Elijah Ben Izzy
03/27/2024, 7:22 PMThierry Jean
03/27/2024, 7:24 PMrun_before_graph_execution
that the HamiltonGraph
contains nodes tagged as materializers. I'm wondering how it handles additional_vars
Stefan Krawczyk
03/28/2024, 5:37 AMStefan Krawczyk
03/28/2024, 6:03 AMpip install <git+ssh://git@github.com/dagworks-inc/hamilton.git@main>
Stefan Krawczyk
03/28/2024, 6:00 PM1.55.1
Roy Kid
03/28/2024, 10:06 PMRoy Kid
03/28/2024, 11:03 PM(wflow) exp/test [ python test.py ] 12:00 AM
^CTraceback (most recent call last):
File "/proj/snic2021-5-546/users/x_jicli/exp/test/test.py", line 35, in <module>
File "/home/x_jicli/miniconda3/envs/wflow/lib/python3.10/site-packages/hamilton/driver.py", line 57, in wrapped_fn
return call_fn(*args, **kwargs)
File "/home/x_jicli/miniconda3/envs/wflow/lib/python3.10/site-packages/hamilton/driver.py", line 1470, in materialize
raw_results = self.raw_execute(
File "/home/x_jicli/miniconda3/envs/wflow/lib/python3.10/site-packages/hamilton/driver.py", line 650, in raw_execute
results = self.graph_executor.execute(
File "/home/x_jicli/miniconda3/envs/wflow/lib/python3.10/site-packages/hamilton/driver.py", line 228, in execute
executors.run_graph_to_completion(execution_state, self.execution_manager)
File "/home/x_jicli/miniconda3/envs/wflow/lib/python3.10/site-packages/hamilton/execution/executors.py", line 374, in run_graph_to_completion
while not GraphState.is_terminal(execution_state.get_graph_state()):
File "/home/x_jicli/miniconda3/envs/wflow/lib/python3.10/site-packages/hamilton/execution/state.py", line 433, in get_graph_state
def get_graph_state(self) -> GraphState:
KeyboardInterrupt
or:
(wflow) x_jicli/exp [ python test.py ] 11:56 PM
^CTraceback (most recent call last):
File "/proj/snic2021-5-546/users/x_jicli/exp/test.py", line 34, in <module>
dr.materialize(*materilizers)
File "/home/x_jicli/miniconda3/envs/wflow/lib/python3.10/site-packages/hamilton/driver.py", line 57, in wrapped_fn
return call_fn(*args, **kwargs)
File "/home/x_jicli/miniconda3/envs/wflow/lib/python3.10/site-packages/hamilton/driver.py", line 1470, in materialize
raw_results = self.raw_execute(
File "/home/x_jicli/miniconda3/envs/wflow/lib/python3.10/site-packages/hamilton/driver.py", line 650, in raw_execute
results = self.graph_executor.execute(
File "/home/x_jicli/miniconda3/envs/wflow/lib/python3.10/site-packages/hamilton/driver.py", line 228, in execute
executors.run_graph_to_completion(execution_state, self.execution_manager)
File "/home/x_jicli/miniconda3/envs/wflow/lib/python3.10/site-packages/hamilton/execution/executors.py", line 374, in run_graph_to_completion
while not GraphState.is_terminal(execution_state.get_graph_state()):
KeyboardInterrupt
Roy Kid
03/28/2024, 11:05 PM# test.py
from hamilton import driver
from hamilton.plugins import h_experiments
from hamilton.io.materialization import to, from_
def connect(a:dict) -> str:
print('connect')
print(a)
return 'connect'
if __name__ == "__main__":
import test
tracker_hook = h_experiments.ExperimentTracker(
experiment_name='exp',
base_directory='.',
)
dr = (
driver.Builder()
.with_modules(test)
.enable_dynamic_execution(allow_experimental_mode=True)
# .with_execution_manager(execution_manager)
.with_adapters(tracker_hook)
.build()
)
materilizers = [
from_.pickle(path='./data.pickle', target='a'),
]
dr.materialize(*materilizers)
I only tested it on HPC, so I don't know if it is environmental problem or my code's problem.Stefan Krawczyk
03/28/2024, 11:58 PMStefan Krawczyk
03/29/2024, 6:41 AMdr.visualize_materialization(*materilizers, output_file_path='./test.png')
But the following executes fine — if we request connect
as an output
dr.visualize_materialization(*materilizers, additional_vars=["connect"], output_file_path='./test.png')
dr.materialize(*materilizers, additional_vars=["connect"])
Roy Kid
03/29/2024, 8:15 PM