Project

General

Profile

Actions

Story #9031

closed

[SDKs] arv-run-pipeline-instance accepts json objects/arrays as script parameter values

Added by Tom Clegg about 6 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assigned To:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Story points:
0.5

Description

Currently it is impossible to pass a JSON object as a script parameter. For example,

arv-run-pipeline-instance 'foo::input={"foo":"bar"}'

results in

"script_parameters":{
  "input":"{\"foo\":\"bar\"}
}

Related issues

Related to Arvados - Bug #3486: [DRAFT] [Crunch] Cannot have script parameter value of "false" because arv-run-pipeline-instance (and also workbench) don't distinguish between "false" and "nil"ResolvedTom Clegg

Actions
Actions #1

Updated by Tom Clegg about 6 years ago

  • Description updated (diff)
Actions #2

Updated by Brett Smith about 6 years ago

  • Tracker changed from Bug to Story
  • Subject changed from arv-run-pipeline-instance should accept json objects/arrays as script parameter values to [SDKs] arv-run-pipeline-instance accepts json objects/arrays as script parameter values

Tom, since you pointed this, is there a particular fix you had in mind?

Actions #3

Updated by Brett Smith about 6 years ago

Note that at least one pipeline author has written Crunch scripts that expect exactly these "JSON strings" and reads them in with json.loads(). Part of the reason for that is Workbench doesn't have any support for input arrays or objects either, so letting pipeline users simply write the JSON by hand in a string is actually the most straightforward solution right now.

Actions #4

Updated by Brett Smith about 6 years ago

Proposed implementation: if your input starts with ", [, or {, it's assumed to be JSON, parsed as such, and then the resulting value is stored as the value of the corresponding parameter.

This potentially breaks compatibility for existing callers of a-r-p-i, but we think we can live with it since it's easy enough to work around: just double-quote (and potentially escape) your string.

Actions #5

Updated by Abram Connelly about 6 years ago

Why not add in a flag so old behavior stays the same while still giving the user the option for more complex parameter passing? Something like:

arv-run-pipeline-instance --json-param 'foo::input={"foo":"bar"}'
Actions #6

Updated by Tom Clegg about 6 years ago

...or even

arv-run-pipeline-instance --param 'foo::input={"foo":"bar"}'

?

Actions #7

Updated by Peter Amstutz over 2 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF