https://dagster.io/ logo
#ask-ai
Title
# ask-ai
b

BC A

03/08/2024, 10:38 AM
@Scout Is there a way to dynamically add tags to OPs before executing them ?
s

Scout

03/08/2024, 10:38 AM
Yes, there is a way to dynamically add tags to ops before executing them. According to the documentation, tags are arbitrary key-value pairs that can be added to run logs. While the documentation does not provide a direct example of dynamically adding tags to ops right before execution, it does mention the use of tags in various contexts. For instance, when executing a job in process, you can pass tags as part of the execution parameters. Here's a general example based on the documentation's description:
Copy code
python result = my_job.execute_in_process(tags={"key": "value"})
In this example,
tags
is a dictionary where you can specify the key-value pairs that you want to associate with the run. However, if you need to add tags dynamically based on some logic that is determined at runtime, you would typically handle this within your job or graph definition by programmatically setting the tags based on the conditions you define. Please note that the documentation does not provide a specific code example for dynamically adding tags immediately before execution, so the approach would depend on the context in which you are running your ops and the mechanisms provided by Dagster for setting tags at runtime. If you have a specific use case or setup in mind, you might need to explore the Dagster codebase or community discussions for more targeted solutions.
2 Views