These are chat archives for nextflow-io/nextflow

26th
Oct 2017
Simone Baffelli
@baffelli
Oct 26 2017 07:17
So, today I learnt that its not such a great idea to mix groovy and bash scripts in a shell process and expect caching to work :grin:
especially if you try to get a repsonse from a REST serivce using groovy and send it to as shell command
Bo
@wenbostar
Oct 26 2017 14:25
If I have 10 samples in a channel, in default, nextflow will do the analysis for all the 10 samples in parallel. How can I control the number of samples to be analyzed in the same time?
Paolo Di Tommaso
@pditommaso
Oct 26 2017 14:46
local computer or cluster ?
Bo
@wenbostar
Oct 26 2017 14:47
@pditommaso , currently I run the workflow in local computer. But I also want to know how to control that in cluster.
Paolo Di Tommaso
@pditommaso
Oct 26 2017 14:50
Bo
@wenbostar
Oct 26 2017 14:51
This is for cluster, right?
Paolo Di Tommaso
@pditommaso
Oct 26 2017 14:52
also local machine
Bo
@wenbostar
Oct 26 2017 15:15
I just did a test. It works well. Thank you so much. @pditommaso
@pditommaso , can I control that for each process?
Bo
@wenbostar
Oct 26 2017 15:27
It works. Thanks again.
I'm new to nextflow so I have a lot of questions. Thank you for your patience and help.
Paolo Di Tommaso
@pditommaso
Oct 26 2017 15:40
:+1:
Daniel E Cook
@danielecook
Oct 26 2017 18:00
Is there a way to detect whether a process is running within a container within the script?
if [[ “${process.container}” -neq “” ]]; do
    command to run if not running in container…
fi
Paolo Di Tommaso
@pditommaso
Oct 26 2017 18:08
in principle code should not depend on a specific container implementation
however you could check task.container to check if a container image has been specified
Daniel E Cook
@danielecook
Oct 26 2017 18:09
ah just figured it out!
Paolo Di Tommaso
@pditommaso
Oct 26 2017 18:09
be aware that a container image can be specified but the container execution may not be actually active
Daniel E Cook
@danielecook
Oct 26 2017 18:09
ok good to know
Paolo Di Tommaso
@pditommaso
Oct 26 2017 18:10
also if you are using singularity it sets some SINGULARITY_XXX env variable
amacbride
@amacbride
Oct 26 2017 22:32
Sort of an odd question, but is it possible to have a process directive be the result of the execution of an external process or method of some kind? For example, if I had a Java or Groovy class, could I do something like this?
(I have tested that I can use variables like task.process, but I'd like to use task.process as a key to something that maps it to a value. Even a hash that I define in Groovy would work)
process showDynamicComment {
    cpus 8
    memory 8g
    clusterOptions "--comment='${SomeClass ${task.process}}'"
    """ 
    echo "this is a process that will wait for 30 seconds"
    sleep 30
    """
}
amacbride
@amacbride
Oct 26 2017 22:40
I almost have it working with a map, but I'm not sure how to handle the double substitution:
def taskMap = [showDynamicComment:'1', someOtherThing:'2']
clusterOptions "--comment='${taskMap.get('showDynamicComment')}'" // works

clusterOptions "--comment='${taskMap.get( ${process.task} )}'" // doesn't work, dislikes the $ in process.task
Any hints? @pditommaso