https://dagster.io/ logo
#ask-community
Title
# ask-community
s

Sanidhya Singh

07/22/2022, 12:35 PM
Hi All! for one of my Dagster use cases, I am executing R scripts via Dagster (using rpy2). Is it possible to view the R code in Dagit similar to how we can view it while executing a notebook op with Dagstermill?
j

jamie

07/22/2022, 2:46 PM
Hi @Sanidhya Singh are you hoping to see the R code in a dagit page like the graph explorer for a job? right now there isn't a native way to show code previews in dagit before execution. But if you wanted to see the R code during the execution of the job then you could probably publish it as Metadata or log it or something like that
s

Sanidhya Singh

07/22/2022, 3:19 PM
Hi @jamie, I was hoping for something like this (this is from a Dagstermill op)
j

jamie

07/22/2022, 4:08 PM
I know we display the metadata section for full jobs, but i'm not sure if we display metadata when you click on a specific op. Let me check into that. In the meantime, to get metadata in the sidebar for a job you have to do
Copy code
@job(
    metadata={
        "owner": "data team",
        "link": MetadataValue.url(url="<https://dagster.io>"),
    },
)
def with_metadata():
    my_op()
(you can also attach metadata in the
to_job
method of a graph) If we do allow specifying metadata like this on ops the main issue I see with this is that the metadata needs to exist when the op is "defined", so you may need to do something lik e
Copy code
r_code = parse_r_script()
@op(
    metadata={
        "r_code": r_code,
    },
)
def my_op():
   # execution code
again, not sure if the metadata attached to ops gets shown in dagit, i'll confirm that for you
update - we don't allow attaching metadata to ops themselves. You could still follow the same pattern as above, but have it be the metadata that's attached to the job. Sorry for the confusion, let me know if there's anything i can help with/clarify
8 Views