deepmodeling/dflow

Slices with multiple parameters

jiawei723 opened this issue · 3 comments

Hi, I'm trying to solve a job with parallel steps. Here is my questions: If I have two input parameters which have three items each, when I use them in one OP , the total number of parallel steps should be nine or six or three? And how this parameters are arranged in each parallel steps? Below is my code:
simulation = Step("simulation",
PythonOPTemplate(Simulation, image="python:3.8",
slices=Slices("{{item}}",
input_parameter=['time', 'temp'],
output_parameter=['dcr', 'name']
)
),
parameters={"time": [2, 5, 8],
"temp": [298.15, 323.15, 348.15]},
with_param=argo_range(9),
key="simulation-{{item}}")
And what should I do if I want to achieve the function that iterating through each parameter combination?

dflow will slice all input parameters simultaneously, just like zip function in Python (for i, j in zip(par1, par2)). How about passing arguments like this
parameters={"time": [2, 2, 2, 5, 5, 5, 8, 8, 8], "temp":[298.15, 323.15, 348.15, 298.15, 323.15, 348.15, 298.15, 323.15, 348.15]}

I get it. So the length of parameters list must be the same for the slices. What if it is not? like parameters={"time": [2, 2, 2, 5, 5, 5, 8, 8, 8], "temp":[298.15, 323.15, 348.15]}. it will generate 3 slices or just error?

The set of indices of slices to be used is determined by with_param argument, independent of length of input list. If the slice index is out of range of input list, error will be raised.