https://dagster.io/ logo
#dagster-support
Title
# dagster-support
g

George Pearse

04/13/2022, 10:53 AM
Can you render html in dagster logs?
2
All I was actually specifically after (currently) was url rendering, which I see I can do with:
Copy code
@op
def emit_metadata(context, df):
    yield AssetMaterialization(
        asset_key="my_dataset",
        metadata={
            "my_text_label": "hello",
            "dashboard_url": MetadataValue.url("<http://mycoolsite.com/my_dashboard>"),
            "num_rows": 0,
        },
    )
Cheers for that!
And possible that
MarkdownMetadataValue
will support everything else I'd want.
z

Zach

04/13/2022, 4:26 PM
I'd still like a better way for emitting formatted metadata to dagster logs without it being tied to an AssetMaterialization. I recently started using `context.instance.report_engine_event()`for this but it feels a bit dirty
❤️ 1
g

George Pearse

04/13/2022, 5:09 PM
I was thinking the same, I thought this had been implemented but I'm currently struggling to re-find it
@Zach how do you then feed in the metadata dict, I want to adopt your hacky fix for the time-being.
z

Zach

04/13/2022, 5:10 PM
let me know if you do find it, that'd be really nice!
this is how I've been doing it -
Copy code
context.instance.report_engine_event(
        message='Launched ECS Task',
        pipeline_run=context.pipeline_run,
        engine_event_data=EngineEventData(
            [
                MetadataEntry("cloudwatch_url",
                              description="",
                              entry_data=MetadataValue.url(task.cloudwatch_url)),
                MetadataEntry('task_arn',
                              description="",
                              entry_data=MetadataValue.text(task.task_arn))
            ]
        )
    )
❤️ 1
g

George Pearse

04/13/2022, 5:12 PM
This might be what we want?
z

Zach

04/13/2022, 5:12 PM
oh sweet, thanks! will try that out
g

George Pearse

04/13/2022, 5:15 PM
Sorry, doesn't seem to be what we're after
Copy code
Runs
Assets
Status
Workspace
Jobs and pipelines
maintain_cxr_lake_pipeline
Legacy
update_dataset_permissions
research_and_development

47292e08
Failure
Run of 
update_dataset_permissions @ d5ccb193

View tags and config

Debug file



Hide not started steps




Re-execute All (*)

0.5s1.0s1.5s2.0s2.5s3.0s3.5s4.0s4.5s5.0s5.5s
run_update_dataset_permissions_pipe


Hide unselected steps
Not executed (0)
No steps are waiting to execute
Executing (0)
No steps are executing
Errored (1)
run_update_dataset_permissions_pipe
1.481s
Succeeded (0)




debug

info

warning

error

critical

event

Copy URL
OP
EVENT TYPE
INFO
TIMESTAMP
run_update_datas…rmissions_pipe
ENGINE_EVENT
Starting initialization of resources [io_manager, pg_handler].
18:14:38.352
run_update_datas…rmissions_pipe
ENGINE_EVENT
Finished initialization of resources [io_manager, pg_handler].
io_manager
PickledObjectFilesystemIOManager - 
io_manager:init_time
0.63ms
pg_handler
PostgresHandler - 
pg_handler:init_time
0.12ms
18:14:38.366
run_update_datas…rmissions_pipe
LOGS_CAPTURED
Started capturing logs for step: run_update_dataset_permissions_pipe.
captured_logs
View stdout / stderr
18:14:38.445
run_update_datas…rmissions_pipe
STEP_START
Started execution of step "run_update_dataset_permissions_pipe".
18:14:38.465
run_update_datas…rmissions_pipe
STEP_FAILURE
dagster.core.errors.DagsterExecutionStepExecutionError: Error occurred while executing op "run_update_dataset_permissions_pipe":
The above exception was caused by the following exception:
KeyError: 'test-name'

Stack Trace:
  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/execution/plan/utils.py", line 47, in solid_execution_error_boundary
    yield
,  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/utils/__init__.py", line 398, in iterate_with_context
    next_output = next(iterator)
,  File "/opt/dagster/pipelines/research_and_development/update_dataset_permissions.py", line 67, in run_update_dataset_permissions_pipe
    'test-name'
,  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/execution/context/compute.py", line 355, in add_output_metadata
    metadata=metadata, output_name=output_name, mapping_key=mapping_key
,  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/execution/context/system.py", line 546, in add_output_metadata
    output_def = self.solid_def.output_def_named(output_name)
,  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/definitions/node_definition.py", line 124, in output_def_named
    return self._output_dict[name]
18:14:39.946
View full message
-
ENGINE_EVENT
Multiprocess executor: parent process exiting after 4.83s (pid: 3612383)
pid
3612383
18:14:40.527
-
RUN_FAILURE
Execution of run for "update_dataset_permissions" failed. Steps failed: ['run_update_dataset_permissions_pipe'].
18:14:40.552
-
ENGINE_EVENT
Process for run exited (pid: 3612383).
18:14:40.591
Error
dagster.core.errors.DagsterExecutionStepExecutionError: Error occurred while executing op "run_update_dataset_permissions_pipe":
  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/execution/plan/execute_plan.py", line 232, in dagster_event_sequence_for_step
    for step_event in check.generator(step_events):
  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/execution/plan/execute_step.py", line 343, in core_dagster_event_sequence_for_step
    _step_output_error_checked_user_event_sequence(step_context, user_event_sequence)
  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/execution/plan/execute_step.py", line 69, in _step_output_error_checked_user_event_sequence
    for user_event in user_event_sequence:
  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/execution/plan/compute.py", line 169, in execute_core_compute
    for step_output in _yield_compute_results(step_context, inputs, compute_fn):
  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/execution/plan/compute.py", line 146, in _yield_compute_results
    user_event_generator,
  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/utils/__init__.py", line 400, in iterate_with_context
    return
  File "/home/dagster/anaconda3/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/execution/plan/utils.py", line 78, in solid_execution_error_boundary
    ) from e
The above exception was caused by the following exception:
KeyError: 'test-name'
  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/execution/plan/utils.py", line 47, in solid_execution_error_boundary
    yield
  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/utils/__init__.py", line 398, in iterate_with_context
    next_output = next(iterator)
  File "/opt/dagster/pipelines/research_and_development/update_dataset_permissions.py", line 67, in run_update_dataset_permissions_pipe
    'test-name'
  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/execution/context/compute.py", line 355, in add_output_metadata
    metadata=metadata, output_name=output_name, mapping_key=mapping_key
  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/execution/context/system.py", line 546, in add_output_metadata
    output_def = self.solid_def.output_def_named(output_name)
  File "/opt/dagster/behold-pipelines/lib/python3.7/site-packages/dagster/core/definitions/node_definition.py", line 124, in output_def_named
    return self._output_dict[name]
Think you have to add the name of an existing asset to use it? Or something like that
z

Zach

04/13/2022, 5:16 PM
oh this might be specifically for adding metadata to an output, so you'd have to reference an output key. dang.
g

George Pearse

04/13/2022, 5:19 PM
@Zach is EngineEventData a custom class? can't find a way to import it?
z

Zach

04/13/2022, 5:20 PM
it's in
dagster.core.events
4 Views