Running tasks on remote systems

To start a job, ecFlow uses the content of the ECF_JOB_CMD variable. By modifying this variable, it is possible to control where and how the job will run. The command should use the ecFlow variables ECF_JOB and ECF_JOBOUT. ECF_JOB contains the name of the job file and ECF_JOBOUT contains the name of the file that should contain the output. The default value of ECF_JOB_CMD runs the job using a bash login shell with the following command:

%ECF_JOB% 1> %ECF_JOBOUT% 2>&1 &

To run the tasks on a remote machine consider using the UNIX command ssh, and defining an ecFlow variable called HOST. Assuming that the job files are visible on ecFlow and remote hosts (e.g. by mounting the same file-system on both hosts), the ECF_JOB_CMD can be defined as follows:

edit ECF_JOB_CMD "ssh %HOST% '%ECF_JOB% > %ECF_JOBOUT% 2>&1 &'"

ecFlow uses standard UNIX permissions, so ensure that $HOME/.ssh contents contain the right settings. Access to this location is needed to allow ecFlow to successfully run the ssh command.

Note

The examples in this section assume the use of bash, but other login shells can be used with the necessary adaptations. For example, if your login shell is csh, you can define ECF_JOB_CMD as

edit ECF_JOB_CMD "ssh %HOST% '%ECF_JOB% >& %ECF_JOBOUT%'"

ECF_JOB_CMD can also submit tasks directly to a queuing system on the target machine. For example, at ECMWF, the UNIX ecf_submit script is used to submit tasks to multiple systems and multiple queuing systems, as follows:

edit ECF_JOB_CMD "ecf_submit %USER% %SCHOST% %ECF_JOB%
%ECF_JOBOUT%"

Alongside this, the task ‘ecf’ scripts include a generic script header that contains typical queuing commands (such as wall clock time and priority), e.g. contents of sample qsub.h:

# QSUB -q %QUEUE%
# QSUB -u %USER%
# QSUB -s /bin/ksh
# QSUB -r %TASK%_%FAMILY1:NOT_DEF%
# QSUB -o %LOGDIR%%ECF_NAME%.%ECF_TRYNO%
# QSUB -lh %THREADS:1%

The ecf_submit script can replace these generic queuing commands with the relevant commands for the host to which the task is submitted and submit the task-relevant way, e.g. for a PBS system it replaces the QSUB commands with the equivalent PBS commands.

Similarly to running a task remotely, to kill a task remotely you need to either send a signal 2 (i.e. kill -2) to the task or issue the relevant queuing system command. Again we have included all this information into a script called ecf_kill that issues the correct command depending on the host. Another example scripts are ecf_status (which shows the status of tasks) and ecfurl (which opens a web link for a task) are included in the latest releases of ecFlow.