DAGWorks Tracking Adapter

Connecting with the DAGWorks platform takes the form of an adapter that forms a plug-in addition to the Hamilton Driver. The Hamilton driver accepts adapters, so adding in DAGWorks, allows you to run your Hamilton dataflows as usual, while also logging/tracking them with DAGWorks.

You can import the adapter as follows:

import os
from dagworks import adapters
from hamilton import driver

And instantiate it:

import my_module_1, my_module_2

 dw_tracking_adapter = adapters.DAGWorksTracker(
    project_id=32, # Replace with your project ID
    api_key=os.environ["DW_API_KEY"], # Securely load your API key
    username="elijah@dagworks.io", # replace with your email
    dag_name="LTV_Model", # replace with your DAG name
    # replace with whatever metadata you want stored with your run/project version
    tags={"env" : "staging", "region" : "US"},
)

driver = (
  driver.Builder()
     .with_config({"config_item_1" : "config_value_1", "config_item_2" : "config_value_2"})
     .with_modules(my_module_1, my_module_2) # python modules with Hamilton functions
     .with_adapters(dw_tracking_adapter) # DAGWorks tracking adapter
     .build()
)

The DAGWorksTracker accepts DAGWorks-specific arguments (all keyword-only):