2

Hi,

I'd like to be able to show hyperlinks in Dagit logs, so that if a process fails then the link can be clicked in the log to open the offending file directly.

I've tried just entering path strings and html, but neither of these approaches work.

According to the Dagster people, it apparently is possible and they do give an example, but I don't understand how to implement this.

If anybody could please help me then that would be amazing!

Thanks,

Phil.

Question about adding hyperlinks to logs:
https://github.com/dagster-io/dagster/issues/7606
Code linked as answer by Dagster guy:
https://docs.dagster.io/_apidocs/ops#dagster.MetadataValue.url

My code is from the example here:
https://medium.com/@stefan-samba/dagstermill-passing-notebook-results-downstream-in-3-steps-58c22d360f89

The code below runs the job:

import dagstermill as dm
from dagster import In, Out, job
from dagster.utils import script_relative_path

load_data = dm.define_dagstermill_op(
    'load_data',                                                                # Name of the op:
    notebook_path=script_relative_path('load_data.ipynb'),                      # Path to the notebook
    outs={'numbers': Out(list, description='list of numbers')}                  # The ops outputs
)

read_data = dm.define_dagstermill_op(
    'read_data',
    notebook_path=script_relative_path('read_data.ipynb'),
    ins={'numbers': In(list, description='list of numbers obtained from\
                                                        load_data.ipynb')}
)

@job(
    resource_defs={
        'output_notebook_io_manager': dm.local_output_notebook_io_manager,
    }
)

def main_job():
    numbers = load_data()
    read_data(numbers)

The following two notebooks are the load_data and read_data steps:

Load data:

import dagstermill as dm
result = [1, 2, 3, 4]
# Log result to UI logs
dm.get_context().log.info(f'Step 1 - load_data - results: {result}')
dm.yield_result(result, 'numbers')

Read data:

import dagstermill as dm
dm.get_context().log.info(f'Step 2 - read_data - loaded numbers: {numbers}')
Phil T
  • 67
  • 7

0 Answers0