Skip to content

Commit

Permalink
Tweaks docs on sdk constants
Browse files Browse the repository at this point in the history
  • Loading branch information
skrawcz committed Nov 18, 2024
1 parent ff484f5 commit 498068e
Showing 1 changed file with 43 additions and 11 deletions.
54 changes: 43 additions & 11 deletions docs/hamilton-ui/ui.rst
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,35 @@ SDK Configuration
------------------
This section documents HamiltonTracker configuration options.

Changing where data is sent
----------------------------
You can change where telemetry is logged by passing in `hamilton_api_url` and/or `hamilton_ui_url` to the
HamiltonTracker constructor. By default, these are set to `localhost:8241/8242`.

.. code-block:: python
from hamilton_sdk import adapters
tracker = adapters.HamiltonTracker(
project_id=PROJECT_ID_FROM_ABOVE,
username="USERNAME/EMAIL_YOU_PUT_IN_THE_UI",
dag_name="my_version_of_the_dag",
tags={"environment": "DEV", "team": "MY_TEAM", "version": "X"},
hamilton_api_url="http://YOUR_DOMAIN_HERE:8241",
hamilton_ui_url="http://YOUR_DOMAIN_HERE:8242" # if using docker the UI is on 8242.
)
dr = (
driver.Builder()
.with_config(your_config)
.with_modules(*your_modules)
.with_adapters(tracker)
.build()
)
Changing behavior of what is captured
-------------------------------------
By default, a lot is captured and sent to the Hamilton UI.

Here are a few options that can change that - these can be found
Expand All @@ -251,17 +280,17 @@ Here we first explain the options:
.. table:: Simple Invocation
:align: left

+-----------------------------+-----------------------------+-----------------------------+
| Option | Default | Explanation |
+=============================+=============================+=============================+
| CAPTURE_DATA_STATISTICS | True | Whether to capture any data insights/statistics |
+-----------------------------+-----------------------------+-----------------------------+
| MAX_LIST_LENGTH_CAPTURE | 50 | Max length for list capture |
+-----------------------------+-----------------------------+-----------------------------+
| MAX_DICT_LENGTH_CAPTURE | 100 | Max length for dict capture |
+-----------------------------+-----------------------------+-----------------------------+
| DEFAULT_CONFIG_URI | ~/.hamilton.conf | Default config file URI. |
+-----------------------------+-----------------------------+-----------------------------+
+-----------------------------+-----------------------------+----------------------------------------------------------+
| Option | Default | Explanation |
+=============================+=============================+==========================================================+
| CAPTURE_DATA_STATISTICS | True | Whether to capture any data insights/statistics |
+-----------------------------+-----------------------------+----------------------------------------------------------+
| MAX_LIST_LENGTH_CAPTURE | 50 | Max length for list capture |
+-----------------------------+-----------------------------+----------------------------------------------------------+
| MAX_DICT_LENGTH_CAPTURE | 100 | Max length for dict capture |
+-----------------------------+-----------------------------+----------------------------------------------------------+
| DEFAULT_CONFIG_URI | ~/.hamilton.conf | Default config file URI. |
+-----------------------------+-----------------------------+----------------------------------------------------------+


To change the defaults via a config file, you can do the following:
Expand All @@ -276,13 +305,15 @@ To change the defaults via a config file, you can do the following:
To change the defaults via environment variables, you can do the following, prefixing them with `HAMILTON_`:

.. code-block:: bash
export HAMILTON_MAX_LIST_LENGTH_CAPTURE=100
export HAMILTON_MAX_DICT_LENGTH_CAPTURE=200
python run_my_hamilton_code.py
To change the defaults directly, you can do the following:

.. code-block:: python
from hamilton_sdk.tracking import constants
Expand All @@ -304,6 +335,7 @@ To change the defaults directly, you can do the following:
.with_adapters(tracker)
.build()
)
dr.execute(...)
In terms of precedence, the order is:

Expand Down

0 comments on commit 498068e

Please sign in to comment.