You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The lambda function shown to provide a dynamic allocation of resources (time/mem) using the input file sizes may not work as documented.
The corresponding bit of the code is things line for f in input['index'] in the lambda function specified in the resource keyword sections. This is because Python expects this to be a list/array of 1 or more values. However, if the index file specified in the input of the rule is a single quoted string this will fail.
For example, this will fail:
rule myrule :
input: index = "some_index_file",
output: ...
resources:
mem_mb = lambda wildcards, input, attempt: math.ceil( sum(os.path.getsize(f) for f in input['index'] if os.path.isfile(f)) / 1024**2*(1+(attempt-1)/10)),
shell: ...
Either of the following two solutions will work:
Making the index in the input an array
rule myrule :
input: index = [ "some_index_file" ],
output: ...
resources:
mem_mb = lambda wildcards, input, attempt: math.ceil( sum(os.path.getsize(f) for f in input['index'] if os.path.isfile(f)) / 1024**2*(1+(attempt-1)/10)),
shell: ...
Coerce the object in the lambda function into an array
rule myrule :
input: index = "some_index_file",
output: ...
resources:
mem_mb = lambda wildcards, input, attempt: math.ceil( sum(os.path.getsize(f) for f in [input['index']] if os.path.isfile(f)) / 1024**2*(1+(attempt-1)/10)),
shell: ...
The text was updated successfully, but these errors were encountered:
The lambda function shown to provide a dynamic allocation of resources (time/mem) using the input file sizes may not work as documented.
The corresponding bit of the code is things line
for f in input['index']
in the lambda function specified in theresource
keyword sections. This is because Python expects this to be a list/array of 1 or more values. However, if theindex
file specified in theinput
of the rule is a single quoted string this will fail.For example, this will fail:
Either of the following two solutions will work:
index
in theinput
an arrayThe text was updated successfully, but these errors were encountered: