Access workflow name from ICON Plugin

Working on a plugin to send metrics to AWS. It would be really cool if I could access the workflow name from within a plugin (without creating an additional plugin input). Is that available anywhere within a python plugin? (Pointers to any other available job metadata would be welcome as well)

When creating AWS Metrics using the PutMetricData api call, there is an option to use the Dimension field to group similar metrics… I’d like to use the workflow name (and possibly step name, orchestrator name, etc) as dimensions of the metric.

You should be able to get at the Workflow Name with:
{{[$job].[name]}}

Is it exposed to the container running the plugin though? My assumption is there is a variable within the container somewhere that has it too. (I’d prefer to not use an action input…)

Are you developing a plugin?

Yea

Oh oh, I see…Ok. Let me look through the SDK and see what I can come up with. There might be something there. No promises, but I thought we added something to that effect.

1 Like

Is there a list of $job variables that you can pull? I thought there was only URL and I had a request out there for some additional ones like name, ID, StartTime and things like that

The quick answer to your question is no.

We don’t expose the WF information in the SDK when you’re running the plugin. That’s kind of by design as the plugins are supposed to be self contained chunks of resources that are mostly stateless and ephemeral*.
(* That’s not exactly right, but it’s a long discussion)

The work around unfortunately is you’ll have to bring that stuff in as inputs to your plugin. You can get the WF name directly from the $job variable.

As for Step Name, Orchestrator…you’ll have to hard code them.

Sorry I don’t have a better answer.

1 Like

Is there a list of $job variables

You can cheat and just do

{{[$job]}}

in an artifact to see all the details of the $job variable.

Right now there’s only name and URL.

1 Like

yeah, i thought of that after I asked, looks like just URL and name

Thanks folks! I’m about to find out if I can set the default value to of an input “{{[$job].[name]}}” … On the upside, this will expose the Dimension attribute on the AWS side, so if anyone wants to re-use the plugin for something else, it’s available :slight_smile:

2 Likes

Fun fact:
default : "{{[$job].[name]}}”
totally works in plugin.spec.yaml

2 Likes

I was wondering when you posted that yesterday. I wasn’t sure if you were going to run into some weird scriptception type bug with us unwrapping and rewrapping the handlebar code.

Thanks for the update!!!

1 Like

Same here, i just discovered/found {{[$job].[url]}} , hope had discovered it a year ago for troubleshooting (Or read it before)!

1 Like