EnFuzion provides command line programs enfsub and enfcmd to communicate with the Dispatcher. The enfsub is primarily used to submit runs for execution. It is also able to handle user identity. The enfcmd program provides a complete set of commands to interact with the Dispatcher. Most common tasks are simplified with high level commands. A complete Dispatcher API is provided for other tasks. All enfcmd commands can be easily used in scripts.
The following sections describe enfsub and enfcmd in detail.
Enfsub has the following options:
enfsub [ <options> ] <program> [ <program_options> ]
enfsub [ <options> ] <script> [ <script_options> ]
enfsub [ <options> ] -run <run_file> [ <input_files> ]
enfsub is used to submit
the run for execution as a command
line program, a script or a parametric execution, respectively.
<options> are:
-login <file_name>
change the user identity to the one specified in the file <file_name>.
-root <host_name>:<port_number>
the address of the EnFuzion network service. If the option is not specified, the address must be specified in the submit.config file.
[ -account | -a ] <name>
a user specified string that is associated with the run for accounting purposes. The string can be used for generation of accounting reports.
[ -name | -n ] <name>
the name of the run.
-nice [on|off][@<host_name>][,[on|off][@<host_name>]]
priority for execution of user jobs on nodes. A different option can be specified for different hosts. If nice is turned on, user jobs are executed at a background priority, allowing them to proceed only when the system would be otherwise idle.
On Windows, nice executes processes at the IDLE_PRIORITY_CLASS class and THREAD_PRIORITY_ABOVE_NORMAL level. For example, a screen saver program on Windows is executed in same class but with level THREAD_PRIORITY_NORMAL. On Linux/Unix, nice executes processes under the nice system call with the value of 10.
[ -export-environment | -x ]
export the values of all environment variables from the submit host to the node.
[ -value | -v ] <name>[=<value>][,<name>[=<value>]]
specify environment variables and their values.
-i <node_file>[=<submit_file>][,<node_file>[=<submit_file>]]
input files for the run. The files are first stored from the submit machine to the root machine and then made available to jobs on nodes.
-o <root_file>[=<node_file>][,<root_file>[=<node_file>]]
output files from the run. The files are copied from nodes and stored in the result directory on the root.
[ -wall-time | -wt ] <hour>[:<minutes>[:<seconds>]]
the maximum wall time interval that the run is allowed to execute.
-e <user_name>@<host_name>,[<user_name>@<host_name>]
the list of recipients for e-mail notifications.
-m [ s | d | a ]
the conditions to sent e-mail notifications. s means execution start, d means execution done, and a means execution abort.
[ -wait | -w ]
wait for the run to complete. Enfsub will not return until the run is completed. This option can be used to include enfsub in scripts that submit a run and then process its results.
[ -results | -r ]
wait for the run to complete and copy run results to the local directory on the submit host. This option can be used to include enfsub in scripts that submit a run and then process its results.
-rd
wait for the run to complete and copy run results to a separate run directory in the local directory on the submit host. This option can be used to include enfsub in scripts that submit a run and then process its results.
[ -start-time | -t ] [[[[<year>-]<month>-]<day>-]<hour>:]<minutes>[.<seconds>]
specify the start time for the run execution. Run execution will be delayed until the start time.
-u <user_name>[@<host_name>][,<user_name>[@<host_name>]]
specify user accounts for job execution on nodes.
[ -count | -c ] <number>
specify a parametric execution. This option specifies the number of jobs that are created for the run. Jobs are distinguished by the environment variable ENFJOBNAME, which has a different value for each job.
-max <number>
specify the maximum number of concurrently executing jobs for the run.
[ -dir | -d ] <path>[@<host_name>][,<path>[@<host_name>]]
specify the working job directory on nodes.
Enfsub uses the following API commands to submit a run:
enfcmd cluster add run name <run_name>
enfcmd copy <run_file> root:run-<run_id>
enfcmd copy <input_file_1> root:run-<run_id>
...
enfcmd copy <input_file_n> root:run-<run_id>
# the following two lines are used for parametric executions
enfcmd run <run_id> load <run_file>
enfcmd run <run_id> start
# the following line is used for command line programs and scripts
enfcmd run <run_id> add command <options>
The last few lines depend on whether the run is a parametric
study or a command line program or a script.
The examples below illustrate how the same run can be performed using a command line program, a script or a run file.
This section gives an example of enfsub usage. It demonstrates the same run, but executed as a command line program, a script and a run file.
The following is the command line example for Windows:
enfsub.exe -n sample -a account -v VAR1=value1 \
-i input.file=input.txt \
-o output-$ENFJOBNAME-$ENFHOSTNAME.txt=output.file,input \
-r -count 2 -e user@domain.com -m d \
"copy input.file input > output.file" \
"set >> output.file"
The following is the same command line example for Linux/Unix:
enfsub.exe -n sample -a account -v VAR1=value1 \
-i input.file=input.txt \
-o output-\$ENFJOBNAME-\$ENFHOSTNAME.txt=output.file,input \
-r -count 2 -e user@domain.com -m d \
"cp input.file input > output.file" \
"set >> output.file"
The following is a Windows script that has the same effect as the command line example above:
@echo off
rem ENF -i script.bat
rem
rem ENF -n sample -a account -v VAR1=value1
rem ENF -i input.file=input.txt
rem ENF -o output-$ENFJOBNAME-$ENFHOSTNAME.txt=output.file,input
rem ENF -r -count 2 -e user@domain.com -m d
copy input.file input > output.file
set >> output.file
The script is submitted with:
enfsub.exe script.bat
The following is a Linux/Unix script that has the same effect as the command line example above:
#!/bin/sh #ENF -i script.sh #ENF -n sample -a account -v VAR1=value1 #ENF -i input.file=input.txt #ENF -o output-$ENFJOBNAME-$ENFHOSTNAME.txt=output.file,input #ENF -rd -count 2 -e user@domain.com -m d cp input.file input > output.file set >> output.fileThe script is submitted with:
enfsub ./script.sh
The following is the run file with the same results:
set VAR1 "value1";
set ENFNOTIFY_EMAIL "user@domain.com";
set ENFNOTIFY_CONDITION "done";
task main
copy input.txt node:input.file
node:execute copy input.file input > output.file
node:execute set >> output.file
copy node:output.file output-$ENFJOBNAME-$ENFHOSTNAME.txt
copy node:input input
endtask
jobs
1
2
endjobs
The run is submitted as:
enfsub -r -run sample.run input.txt
Enfcmd has the following syntax:
enfcmd [host <hostname> <port>] [refresh <seconds>] \
show [detailed] [ cluster | run <run_id> | node <node_name> ] |
submit <run_file> [ <input_file_1> ... <input_file_n> ] |
copyrun <run_id>
copy <file_name> user[:<directory>] |
copy <file_name> root[:<directory>] |
identity |
<API_command>
The host <hostname> <port> command defines the host and the port of the Dispatcher that enfcmd connects to. The command is optional. If it is not specified, the values from the submit.config file are used.
If the refresh command is specified, enfcmd repeats the requested action every <seconds> seconds.
The show command prints out information about the Dispatcher. The following options can be added to the show command:
detailed
Detailed information is provided.
cluster
Only information about the cluster is printed out.
run <run name>
Only information about the <run_id> run is printed out.
node <node_name>
Only information about the <node_name> node is printed out.
The submit <run_file> [ <input_file_1> ... <input_file_n> ] command submits a new run for execution. It performs the following steps:
creates a new run,
copies the run file <run_file> from the current directory on the submit system to the EnFuzion root system,
copies input files <input_file_1> ... <input_file_n> from the current directory on the submit system to the run directory on the EnFuzion root system,
and starts the run execution.
enfcmd cluster add run name <run_name>
enfcmd copy <run_file> root:run-<run_id>
enfcmd copy <input_file_1> root:run-<run_id>
...
enfcmd copy <input_file_n> root:run-<run_id>
enfcmd run <run_id> load <run_file>
enfcmd run <run_id> start
The copyrun <run_id> copies files from the run directory on the EnFuzion root system to the current working directory on the local system. The run directory is preserved.
The copy <file_name> user[:<directory>] command copies file <file_name> from the EnFuzion root system to directory <directory> on the local system. If <directory> is omitted, the file is copied to the current working directory.
The copy <file_name> root[:<directory>] command copies file <file_name> from the local system to directory <directory> on the EnFuzion root system. If <directory> is omitted, the file is copied to the main Dispatcher directory.
The identity command generates a user identification file, named <user>@<host_name>.enflogin. <user> is the user account name on the submit system and <host_name> is the host name of the system. The file contains an encoded user identification string. The file can be copied to another system or user account to represent the same user.
<API_command> is used to pass API commands directly to the Dispatcher. <API_command> is an API command string.
The example below demonstrates the use of enfcmd to get all run identifiers from the Dispatcher:
Example:
# enfcmd host localhost 3521 cluster get runs
0237200033 0237200034
If no command is specified in the command line, the enfcmd reads the command from standard input, which is useful in scripts.
The example below demonstrates how additional tasks can be specified by using the enfcmd in a shell.
Example:
#!/bin/sh
# parameter $1 is the port number of the Dispatcher
# parameter $2 is the run ID to which the script adds a new task
director="enfcmd host localhost $1"
echo $director
# Read task specification from stdin
$director <<EOF
run $2 add task testtask
execute echo testtask executed on `date`
node:execute ps -ef | grep enf > ps.$ENFJOBNAME
node:copy node:ps.$ENFJOBNAME .
endtask
EOF
# Add a job which executes the added task
# and return the status
addjob_status=`$director run $2 add job task testtask`
# Print status
echo Added task status:$addjob_status
The script accepts the Dispatcher port as the first argument and must be executed on the same host as the Dispatcher.
Root options privileges, see details in the Section called Enforcing Privileges in Chapter 6, and protect, see details in the Section called Prevent Execution of User Programs on the EnFuzion Root System in Chapter 6, affect which actions can be performed by enfsub and enfcmd users. By default, privileges and protect are turned off, which allows any action to be performed by any user. The option noanonsubmit, see details in the Section called Rejecting Anonymous Run Submission in Chapter 6, does not affect enfsub and enfcmd, since they always provide a user ID with the job submission.
If privileges are turned on, then the following actions are permitted only by users with administrative privileges:
if API commands are used by enfcmd, their usage follows the rules described in the Section called Handling of Privileges under the API commands.
If protect is turned on, then the user is not allowed to specify files outside of the run directory on the root. Files names must be relative and are not allowed to start with "/", "\", "<letter>:" or contain the string "..". The following commands are affected:
enfcmd copy;
enfcmd copyrun;
enfcmd submit;
enfsub -i;
enfsub -o.
The Dispatcher offers IP-based authentication for enfsub and enfcmd access. The administrator can set a list of IP addresses that are allowed or denied to connect to the Dispatcher with enfsub and enfcmd (see the Section called Restricting Access to the Dispatcher Interface in Chapter 6 for details).