[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Condor-users] passing parameters through nested DAGs?



On Wed, May 23, 2012 at 09:29:58AM -0700, Triplett, Sara wrote:
> Hi all,
> 
> I am very new to working directly with Condor and am trying to learn more about building DAGs.  I have a workflow that can be represented with nested DAGs, and I'm wondering if there is something like VARS that works with DAGs.  I have a master DAG that needs to call several other DAGs, and each of these is identical except that they need to pass distinct parameters to the submit files they call.  For example:
> 
> # File name: dagA.dag
> JOB FirstJob template.sub
> JOB SecondJob othertemplate.sub
> VARS FirstJob myparam="A"
> VARS SecondJob myparam="A"
> 
> # File name: dagB.dag
> JOB FirstJob template.sub
> JOB SecondJob othertemplate.sub
> VARS FirstJob myparam="B"
> VARS SecondJob myparam="B"
> 
> And so on.  Is there some elegant way to have one "template" DAG file that takes and passes myparam through to the called .sub files?  Or do I actually need separate DAG files?

Here is a recipe to do what you want. You will adapt it to your needs.

The dag file would be something like

subdag external A dagA.dag
script pre A pre.sh $JOB
subdag external B dagB.dag
script pre B pre.sh $JOB
(and so on)

Then pre.sh would be

#!/bin/bash
cat > dag${1}.dag <<HERESCRIPT
JOB FirstJob template.sub
JOB SecondJob othertemplate.sub
VARS FirstJob myparam="$1"
VARS SecondJob myparam="$1"
HERESCRIPT

Nathan Panike