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
[hrzolix]
I'm trying to give our users freely to choose parameters for tools, so far cores and memory work but I've tried to add the option for choosing queue, because we in background we have cpu, cpu_30, cpu_180 (7, 30, 180 days). I'm running into a problem here NameError: name 'params' is not defined
[Nuwan Goonasekera]
Can you try using a context variable instead? Using params within params is possible, but tricky and probably not worth the trouble. Something like this should work:
[hrzolix]
Hi Nuwan, I tried this and I got an error for queue does not exits, apparently it parses directly: -q {str(job.get_param_values(app)['__job_resource']['queue'])} -l select=1:ncpus=4:mem=8GB
[Nuwan Goonasekera]
Aah yes! I forgot that context variables must be constants. In that case, can you try reverting to your original code, but refer to params as entity.params?:
In the long run, we should probably consider adding support for computed context variables instead. That makes it much nicer I reckon
[hrzolix]
hm again its the same unfortunately : -q {str(job.get_param_values(app)['__job_resource']['queue'])} -l select=1:ncpus=6:mem=4GB
Here is the job_resource_params_conf.xml if it helps
<parameters>
<paramlabel="Cores"name="cores"type="integer"min="1"max="128"value=""help="Number of processing cores, 'ncpus' value (1-128). Leave blank to use default value(1)." />
<paramlabel="Queue"name="queue"type="select"value=""help="Depending on job time, choose a queue for your job(cpu=7days, cpu_30=30 days cpu_180=180 days.)">
<optionvalue="cpu_180">CPU_180 (default)</option>
<optionvalue="cpu_30">CPU_30</option>
<optionvalue="cpu">CPU</option>
</param>
<paramlabel="Memory"name="mem"type="integer"min="4"max="480"value=""help="Memory size in gigabytes, 'mem' value (4-256). Leave blank to use default value(3.8GB)." />
</parameters>
[Nuwan Goonasekera]
You're right, it doesn't work that way. This is because of the evaluation order of variables. You can use this instead:
context
From hrzolix on matrix
[hrzolix]
I'm trying to give our users freely to choose parameters for tools, so far cores and memory work but I've tried to add the option for choosing queue, because we in background we have cpu, cpu_30, cpu_180 (7, 30, 180 days). I'm running into a problem here NameError: name 'params' is not defined
Here is the tpv_rules_local.yml:
[Nuwan Goonasekera]
Can you try using a context variable instead? Using params within params is possible, but tricky and probably not worth the trouble. Something like this should work:
[hrzolix]
Hi Nuwan, I tried this and I got an error for queue does not exits, apparently it parses directly: -q {str(job.get_param_values(app)['__job_resource']['queue'])} -l select=1:ncpus=4:mem=8GB
[Nuwan Goonasekera]
Aah yes! I forgot that context variables must be constants. In that case, can you try reverting to your original code, but refer to params as entity.params?:
In the long run, we should probably consider adding support for computed context variables instead. That makes it much nicer I reckon
[hrzolix]
hm again its the same unfortunately : -q {str(job.get_param_values(app)['__job_resource']['queue'])} -l select=1:ncpus=6:mem=4GB
Here is the job_resource_params_conf.xml if it helps
[Nuwan Goonasekera]
You're right, it doesn't work that way. This is because of the evaluation order of variables. You can use this instead:
That'll work for now, but the downside is that it passes a needless environment variable to the tool
The text was updated successfully, but these errors were encountered: