Hello,
following the docs I’m trying to trigger a pipeline with some variables. Some of them are key-value pairs, while others are file types.
I build an array of variables and execute an API call like so
parameters = dict(model_input_rel_path='../input/16T_rel_slotted.json',
cadata_abs_path='../input/roxieold_2.cadata',
peak_field = 15,
L_mag = 0.1,
R_EE = 1,
full_output = True)
input_files = {"input_file": "test"}
variables = [{'key': 'NOTEBOOK_PATH', 'value': 'demo/thermal/MIITs.ipynb'},
{'key': 'NOTEBOOK_OUT_PATH', 'value': 'demo/thermal/MIITs_out.ipynb'},
{'key': 'HTML_OUT_PATH', 'value': 'demo/thermal/MIITs_out.html'},
{'key': 'parameters', 'variable_type': 'file', 'value': json.dumps(parameters)},
{'key': 'input_files', 'variable_type': 'file', 'value': json.dumps(input_files)},
]
rsp = requests.post('https://gitlab.cern.ch/api/v4/projects/136891/trigger/pipeline',
json={'token': '', 'ref': 'gitlab_execute', 'variables': variables})
rsp
In response I got 400 error: '{"error":"variables is invalid"}'
.
My requirement is to pass a dynamic dictionary for parameters
and input_files
. What am I missing here?
Thank you in advance for any help you may offer!