-
|
I'm hoping to find a good example of using input.data inside a plugin. Example, #142 talks about using What I can't figure out is how to reference those from within a plugin (example the shell plugin, where i seem to be doing the majority of my testing). I'm not sure how you reference the data (or if it's possible). I've checked Is it possible to reference that information, or is it limited to use by xyops in inter-plugin operations? I assume this question is also relevant with bucket json data (ie if i wanted to reference the json data in a bucket programatically). Maybe I'm looking at the wrong place in the docs? I did a keyword search, but didn't come up with anything that stated 'data fields are not for use within plugins' or 'here's how to assign a data field/value to an environment variable' Again, thanks for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
The input data is available as part of the JSON piped to your process STDIN: https://docs.xyops.io/plugins/job-input So you need to consume (read) a line from STDIN, and parse the JSON. The input data is available as #!/bin/bash
IFS= read -r line
foo=$(printf '%s\n' "$line" | jq -r '.input.data.foo')
echo "Foo is: $foo"The JSON itself is a xyOps Job object, described in full detail here: https://docs.xyops.io/data/job Example test run setup with pre-populated data:
Job output:
Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
|
Exactly what I needed. Thanks for your patience. You had the details in your docs, but the shell example was the missing glue i needed to tie it together. I'll make sure to load the data stream as step 1 in future scripts, and that answers a handful of questions I'm sure I would've had. Fantastic! |
Beta Was this translation helpful? Give feedback.


The input data is available as part of the JSON piped to your process STDIN:
https://docs.xyops.io/plugins/job-input
So you need to consume (read) a line from STDIN, and parse the JSON. The input data is available as
input.datainside that JSON record. This is a bit tricky with shell script, as it doesn't have native support for parsing JSON. However, you can use a 3rd party tool such as jq. Example:The JSON itself is a xyOps Job object, described in full detail here: https://docs.xyops.io/data/job
Example test run setup with pre-populated data:
Job output:
Hope this helps!