Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This section describes how to use suite definition variables in ecFlow files. Suite definition variables are defined by the "edit" keyword. The section on "ecFlow pre-processor" gives more information on how variables are used.
In an ecFlow script, variables are written as text enclosed by a pair of '%' characters (the edit-character or micro-character). As in C-format strings, if there are two %-characters together they are concatenated to form a single %-character in the job-file.

For example if you need to execute UNIX command:

Code Block
date +%d


In a job, you must enter it as following into an ecFlow file:

Code Block
date +%%d


At present, the default edit-character is %. It can only be defined when ecFlow is compiled. It can be redefined by setting the variable ECF_MICRO.
A user defines variables in a suite definition file using the edit keyword. User defined variables can occur at any node level: suite, family or task. ecFlow also generates variables from the node name, the host on which ecFlow is running, the time, the date and so on.
When a variable is needed at submission time, it is first sought in the task itself. If it is not found in the task, it is sought from the task's parent and so on, up through the node levels until found. For any node, variables are looked for in the following order:

...

An undefined variable causes a task to abort immediately, without the job being submitted. A flag is set in the task and an entry is written into ECF-logfile. If this is too severe you can use default variables in your scripts

Code Block
%VAR:value% 


If variable "VAR" is not found, then we use a default value of "value"
Clever use of variables can, however, save a lot of work. For example you can use the same script in multiple places, but configure it to behave differently depending on the variable set.