HTCondor(4): Submit files (HowTo)

Please note that all the SIEpedia's articles address specific issues or questions raised by IAC users, so they do not attempt to be rigorous or exhaustive, and may or may not be useful or applicable in different or more general contexts.

IMPORTANT: This documentation is deprecated. It will not be further updated. The new documentation for HTCondor can be found here

HTCondor submit files (HowTo)

Submit file HowTo

HTCondor has a huge set of commands that should cover most possible scenarios. It is impossible to describe here all of them, but you can read the official documentation to get further information (there are many of these commands at the condor_submit page. Just to complement some of the examples, we will mention here a few useful commands that can be added to the submit file when needed. You can also find more details about these and other commands at the FAQs page.

How to ... add requirements on the target machines where my jobs will be run? ^ Top

If your program has some limitations (memory, disk, libraries, etc.) and cannot run in all machines, you can use requirements command to tell HTCondor what those limitations are so it can execute your jobs only on machines that satisfy those requirements. If you try next command condor_status -long <your_machine> in your shell, it will list all the parameters that HTCondor has about each slot of your machine, and most of those parameters can be used to add requirements. Conditions and expressions could be as complex as needed, there is a number of operators, predefined functions, etc. that can be used. For memory, disk and CPUs you can also use request_memory, request_disk and request_cpus, respectively.

For example, if your program needs at least 1.5 GB of RAM and 5 GB of free space in disk, and due to library dependencies it can only run on machines with Linux Fedora17 or above, add next commands in your submit file:

 request_disk   = 5 GB
 request_memory = 1.5 GB
 requirements   = (UtsnameSysname == "Linux") && (OpSysName == "Fedora") && (OpSysMajorVer >= 17)

Be careful when specifying the values since the default unit for request_disk is KB and MB for request_memory. It is much better to always specify the unit (KB or K, MB or M, GB or G, TB or T).

Caution!: Be careful when choosing your restrictions, using them will reduce the amount of available slots for your jobs so it will be more difficult to execute them. Also check that you are asking for restrictions that can be satisfied by our current machines, or your jobs will stay always in idle status (you can check the reasons why a job is idle using condor_q -analyze <>). Before adding a requirement, always check if there are enough slots that satisfy it. For instance, to see which slots satisfy the requirements of this example, use next command (you can add flag -avail to see only the slots that could execute your job at this moment):

 [...]$ condor_status -constraint '(UtsnameSysname == "Linux") && (OpSysName == "Fedora")  
                    && (OpSysMajorVer >= 17) && (Memory > 1536)  && (Disk >= 5120000)'

If you already know which machines are not able to run your application, you can force HTCondor to avoid them... or the opposite: run your application only on some machines (see this FAQ where this is explained).

How to ... add preferences on the target machines where my jobs will be run? ^ Top

Preferences are similar to requirements, but they do not limit the machines (you can use both preferences and requirements in the same submit file). HTCondor will try to satisfy your preferences when possible, assigning a rank to the available machines and choosing those with higher value. For example, we would like to use slots with at least 4GB of RAM if they are available and the more available disk space, the better. Then commands to add should be the following ones:

 Rank  = Disk && (Memory >= 4096)

Rank is evaluated as a float point expression, and always higher values are the better ones. Then, you can do arithmetic operations to emphasize some parameters. For example, the first expression will consider the floating point speed but will give more importance to run on machines with my same Operating System, while the second expression will choose machines with higher values of RAM, and those with also more than 100GB of disk will have 200 extra points:

 Rank  = kflops + (1000000 * (TARGET.OpSysAndVer == MY.OpSysAndVer))
 Rank  = Memory + (200 * (Disk >= 102400))   

How to ... get/set environment variables? ^ Top

If you application needs them, use the getenv command and HTCondor will create a copy of your environment variables at the submitting time so they will be available for your program on the target machine. Also you can create/modify environment variables if needed with the environment command. The environment variables can be also used in the submit file using the ENV command.

For example, add next commands if you want that your executable can access your environment at the submitting time, then set variables called working_dir and data_dir pointing to some directories, and finally create a macro called home_dir that contains your home directory to be used in your submit file:

 getenv        = True
 environment   = "working_dir=/path/to/some/place data_dir=/path/to/data"
 home_dir      = $ENV(HOME)

If you want to run your python program using HTCondor, you might need to define some environment variables, please, read this FAQ.

How to ... control HTCondor notifications? ^ Top

If you are submitting a large set of jobs, receiving notifications from all of them can be annoying. You can set the email address and the type of the notifications that you want to receive. For example, to send notifications to only in case of errors, use following commands:

 notify_user   =
 notification  = Error

notify_user changes the email address used to send notifications, if you need to add more addresses, you can use email_attributes command. With notification command we tell HTCondor when it should send those notifications, it could be set to Never, Complete, Error or Always; we recommend you use Error.

How to ... run some shell commands/scripts/programs before/after our application? ^ Top

If your application needs some pre- or post-processing, you can use +PreCmd and +PostCmd commands to run it before and after your main executable, respectively. For example, these commands may be useful if you need to rename or move input or output files before or after the execution. You can also use them for debugging purpose, for instance, use tree command to check where the input/output files are located:

 +PreCmd        = "tree"
 +PreArguments  = "-o tree_before.$(Cluster).$(Process).txt"
 +PostCmd       = ""
 +PostArguments = "-g"

 should_transfer_files  = YES
 transfer_input_files   =, /usr/bin/tree
 transfer_output_files  = tree_before.$(Cluster).$(Process).txt

Remember that you have to add those scripts/programs to the list of files to be copied with transfer_input_files command, and also check that your submit file contains the following command: should_transfer_files = YES. When using a shell command (like tree), you can get its location using the command which. For instance, which tree will show /usr/bin/tree, this is the path you should add to transfer_input_files command.

How to ... specify the priority of your jobs? ^ Top

HTCondor uses two different types of priorities: job priority (which of your jobs will run first) and users priority (which users will run their jobs and how many of them).

Job priority

If some of your jobs/clusters are more important than others and you want to execute them first, you can use the priority command to assign them a priority (the higher the value, the higher priority). For instance, if you want to execute first the last jobs of a cluster (reverse order), you can use next command:

 priority      = $(Process)

Remember that after submitting your jobs, you can set or change their priority using the shell command condor_prio.

Users priority

Whenever your jobs are being executed, your user priority is decreased (the more jobs are executed, the faster you lose priority). Users with best priority will run more jobs and they will begin sooner, so if your jobs are not so important or the queue is empty, you can use nice_user command to run them without wasting your priority. If you set this command to True, your jobs will be executed by a fake user with very low priority, so you will save your real priority (but it is likely your jobs will not be executed unless the queue is almost empty).

 nice_user     = True

Those jobs will be run with user nice-user.<your_user> and they will not change your user's priority (you can use shell command condor_userprio -allusers to see your and other users' priority).

Remember that using condor_qedit command you can change the attributes of your jobs after submitting them (see this FAQ). We can use this command to change the status of NiceUser attribute depending on how many slots are free (if there are many free slots, then we can set our jobs as nice to run them without affecting our priority, or the opposite, setting NiceUser to false when there are no free slots). For instance, use next commands to set all jobs belonging to Cluster ID 1234:

  [...]$ condor_q 1234 -af ProcId NiceUser  #Check current status
         0 false
         1 false

  [...]$ condor_qedit 1234 NiceUser True
         Set attribute "NiceUser".

  [...]$ condor_q 1234 -af ProcId NiceUser  #Check current status
         0 true
         1 true

If user priority is a critical factor to you, you may want to periodically check the queue to change the NiceUser attribute according to the current status, setting it to True when you are the only active user or there is a large number of available slots, and set it to False when there are more active users or a few available slots. In order to simplify this process, we have developed a script that automatically performs those operations, you only need to specify your username or a particular clusterID (and optionally a minimum number of available slots) and it will change the NiceUser attribute to save your real priority as much as possible. You can copy the script from /net/vial/scratch/adorta/htcondor_files/ and use it (or modify it) whenever you want. You can even periodically execute it using crontab (but please, do NOT run it too often to avoid overloading the system, every 30 or 60 minutes is fine). Run it with no arguments to get the description and syntax.


  • You can use condor_qedit -constraint ... to change the attributes of only some of your jobs.
  • Condor can evaluate the attributes only when jobs begin to run, so new values may not affect the currently running jobs at the time of using condor_qedit, but they will be valid in jobs that begin to run after using the command.

How to ... deal with jobs that fail? ^ Top

Sometimes jobs fail because there are problems when executing your program. It could happen that the problem is not in your program, but in the machine that executed it (a missing or misconfigured application, a library with a different version from the one you need, etc.). Then you should identify those problematic machines and use requirements commands in your submit file in order to block them, as is explained in this FAQ. For example, to block machines with names piston and loro use only one of the next commands (both are equivalent):

 requirements = ((UtsnameNodename =!= "piston") && (UtsnameNodename =!= "loro"))  
 requirements = !stringListMember(UtsnameNodename, "piston,loro")

You can also block all machines that satisfy a pattern. For instance, to avoid executing your jobs on those machines with names beginning with "k", "c" and "l", add next lines (you can specify more complex patterns using the predefined functions and macros):

  letter       = substr(toLower(Target.Machine),0,1)
  requirements = !stringListMember($(letter), "k,c,l")

Sometimes it is better to specify a list of machines where your application can run (and avoid any other that is not in that list). For that purpose, just use previous expressions after negating them with an exclamation mark "!" (or remove it if they were already negated).

After avoiding machines that are not able to run your program, you should submit again your jobs. But, please, execute only those jobs that failed (check this FAQ to see how), do not execute again jobs that were already correctly executed to avoid wasting time and resources. For instance, add next command to only execute jobs with Process ID 0, 13, 25 and those from 37 to 44:

   noop_job = !( stringListMember("$(Process)","0,13,25") || (($(Process) >= 37) && ($(Process) <= 44)) )

Note: noop_job will not execute those jobs where the condition is True. Therefore, if you want to specify a list of jobs to be executed, you need to negate your expression adding an exclamation mark at the beginning: noop_job = !(...). On the other hand, if you want to specify a list of jobs that should not be executed, then use the expression without negating it.

Jobs that are not executed may stay in the queue with Complete status (when using condor_q you will see that ST column is C). To remove all C jobs from the queue, try next command in your shell (use the second one to remove only Complete jobs that belongs to cluster XXX):

  condor_rm -constraint 'JobStatus == 4'
  condor_rm -constraint 'JobStatus == 4 && clusterID == XXX'

Also, it could be interesting to avoid the black holes: suppose that each of your jobs needs hours to finish, but they fail in an specific machine after a few minutes of execution time. That means that machine will be idle every few minutes, ready to accept another of your jobs, that will also fail, and this process may repeat again and again... sometimes a failing machine could even execute almost all your jobs... That is known as black hole. To avoid it, we can force HTCondor to change machines when sending jobs. For that purpose add these lines to your submit file:

  #Avoid black holes: send to different machines
  job_machine_attrs = Machine  
  job_machine_attrs_history_length = 5           
  requirements = $(requirements) && (target.machine =!= MachineAttrMachine1) && (target.machine =!= MachineAttrMachine2)

When there are problems with your jobs, you should receive an email with an error and some related information (if it was not disabled using notification command as explained above) and the job will leave the queue. You can change this behavior with on_exit_hold and/or on_exit_remove commands, forcing HTCondor to keep that job in the queue with status on hold or even as idle so it will be executed again:

Command True False
on_exit_hold Stay in the queue with on hold status Leave the queue
on_exit_remove Leave the queue Stay in the queue with idle status (it can be executed again)

Last commands will be evaluated when jobs are ready to exit the queue, but you can force a periodic evaluation (using a configurable time) with commands like periodic_hold, periodic_remove, periodic_release, etc., and then decide if you want to hold/remove/release them according to your conditions. There are also some other commands to add a reason and/or a subcode when holding/removing/releasing these jobs. On the other hand, you can force your jobs to exit the queue when they satisfy a given condition using noop_job, or they stay in the queue even after their completion using leave_in_queue command (those jobs will stay in the queue with Complete status till you remove them using shell command condor_rm).

In the official HTCondor documentation there are some examples about how to use these commands (all valid JobStatus could be displayed using shell command: condor_q -help status):

  • With the next command, if the job exits after less than an hour (3600 seconds), it will be placed on hold and an e-mail notification sent, instead of being allowed to leave the queue:
   on_exit_hold = ((CurrentTime - JobStartDate) < 3600)
  • Next expression lets the job leave the queue if the job was not killed by a signal or if it was killed by a signal other than 11, representing segmentation fault in this example. So, if it exited due to signal 11, it will stay in the job queue. In any other case of the job exiting, the job will leave the queue as it normally would have done.
   on_exit_remove = ((ExitBySignal == False) || (ExitSignal != 11))
  • With next command, if the job was killed by a signal or exited with a non-zero exit status, HTCondor would leave the job in the queue to run again:
   on_exit_remove = ((ExitBySignal == False) && (ExitCode == 0))
  • Use the following command to hold jobs that have been executing (JobStatus == 2) for more than 2 hours (by default, all periodic checks are performed every 5 minutes. Please, contact us if you want a shorter period):
   periodic_hold = ((JobStatus == 2) && (time() - EnteredCurrentStatus) >  7200)
  • The following command is used to remove all completed (JobStatus == 4) jobs 15 minutes after their completion:
   periodic_remove = ((JobStatus == 4) && (time() - EnteredCurrentStatus) >  900)
  • Next command will assign again the idle status to on hold (JobStatus == 5) jobs 30 min. after they were held:
   periodic_release = ((JobStatus == 5) && (time() - EnteredCurrentStatus) >  1800)

IMPORTANT: periodic_release command is useful when your program is correct, but it fails in specific machines and gets the on hold status. If that happens, this command will allow HTCondor to periodically release those jobs so they can be executed on other machines. But use this command with caution: if there are problems in your program and/or data, then your application could be indefinitely held and released, what means a big waste of resources (CPU time, network used in file transferring, etc.) and inconveniences for other users, be careful! (you can always remove your jobs using condor_rm command in your shell).

When using periodic_remove or periodic_hold HTCondor submit commands, running jobs that satisfy the condition(s) will be killed and all files on remote machines will be deleted. Sometimes you want to get some of the output files that have been created on the remote machine, maybe your program is a simulation that does not converge for some sets of inputs so it never ends, but it still produces valid data and you want to get the output files. In those cases, do not use the mentioned submit commands because you will lose the output files, and use instead utilities like timeout in order to limit the time that your application can be running. When using this linux command, you specify the maximum time your program can run, and once it reaches that limit, it will be automatically killed. Then HTCondor will detect your program has finished and it will copy back the output files to your machine as you specified. Next example will show how to limit the execution of your program up to 30 minutes:

  # Some common commands above...

  # Max running time (in seconds)
  MAX_TIME = 30 * 60

  # Your executable and arguments
  MY_EXEC = your_exec
  MY_ARGS = "your_arg1 your_arg2"

  # If your executable is not a system command, do not forget to transfer it!
  transfer_input_files = your_inputs,$(MY_EXEC)
  # By default all new and modified files will be copied. Uncomment next line to indicate only specific output files
  #transfer_output_files = your_outputs

  executable          = /bin/timeout
  # Since timeout is a system command, we do not need to copy it to remote machines
  transfer_executable = False
  arguments           = "$INT(MAX_TIME) $(MY_EXEC) $(MY_ARGS)"

  queue ...

How to ... limit the number of concurrent running jobs? ^ Top

There are some situations where it could be interesting to limit the number of jobs that can concurrently run. For instance, when your application needs licenses to run and few of them are available, or when your jobs access a shared resource (like directly reading/writing files located at scratch, too many concurrent access could produce locks and a considerable slowdown in your and others' computer performance).

To deal with these situations, HTCondor is able to manage limits and apply them to running job. Different kinds of limits can be defined in the negotiator (the machine that decides which job will run on which slot), but, unfortunately, you cannot change its configuration (for obvious security reasons, only administrators can do that). If you want to use a limit, you can contact us so we will configure it, but there is an easier way to use this feature without changing the configuration: we have set a high default value (1000 units) for any undefined limit, so you only need to use a limit not defined yet and adjust the number of consumed units per job. For example, suppose that you would like to limit your concurrent running jobs to 20: then you only need to specify that every job consumes 50 units of that limit (1000 / 20 = 50). In this way no more than 20 jobs could concurrently run.

The command used to specify limits is concurrency_limits = XXX:YYY, where XXX is the name of the limit and YYY is the number of units that each job uses. You can use any name for the limit, but it should be unique, so we recommend you include your username in it.

  • For instance, if your username is jsmith and you want to specify a limit of 12 running job (1000 / 12 ~= 83 units/job), just add next line to your submit file:
     concurrency_limits = jsmith:83
  • Previous command will affect all your jobs that use that limit, even in different submissions. If you want to set limits that are only applied to each submission, you can use a combination of your username and the cluster ID in the name of the limit:
     concurrency_limits = jsmith$(Cluster):83
  • If you need it, you can use several limits and specify them in the same command line, using commas to build the list of limits and consumed units per job. For instance, next line will limit to 12 the number of running jobs in this submission and to 25 (1000 / 25 = 40) the number of your total running jobs where the common limit jsmith_total has been used:
     concurrency_limits = jsmith$(Cluster):83,jsmith_total:40
  • If you are executing jobs with IDL without the IDL Virtual Machine, then each job will be using one license. Since the total amount of licenses is limited, you must add next line in your submit file:
     concurrency_limits = idl:40

Limits can be changed after jobs are submitted using condor_qedit command. For instance, we want to change the limit that we have previously set to jsmith:83 (12 concurrent jobs) to jsmith:50 (20 concurrent jobs) in all jobs belonging to Cluster with ID 1234. Then use next commands:

  [...]$ condor_q 1234 -af ProcId ConcurrencyLimits  #Check current limit
         0 "jsmith:83"
         1 "jsmith:83"

  [...]$ condor_qedit 1234 ConcurrencyLimits '"jsmith:50"'
         Set attribute "ConcurrencyLimits".

  [...]$ condor_q 1234 -af ProcId ConcurrencyLimits  #Check current limit
         0 "jsmith:50"
         1 "jsmith:50"

Values may have to be specified using quotes; be careful if your value is a string since you will be need to combine simple and double quotes, like '"..."' (see example above).

Note: HTCondor may evaluate the attributes only when jobs begin to run, so new values may not affect the currently running jobs at the time of using condor_qedit, but they will be valid in jobs that begin to run after using the command.

How to ... do some complex operations in my submit file? ^ Top

If you need to do some special operations in your submit file like evaluating expressions, manipulating strings or lists, etc. you can use the predefined functions and some special macros that are available in HTCondor. They are specially useful when defining conditions used in commands like requirements, rank, on_exit_hold, noop_job, etc. since they will allow you to modify the attributes received from the remote machines and adapt them to your needs. We have used some of these predefined functions in our examples, but there are many others that could be used:

  • evaluate expressions: eval(), ...
  • flow control: ifThenElse(), ...
  • manipulate strings : size(), strcat(), substr(), strcmp(), ...
  • manipulate lists: stringListSize(), stringListSum(), stringListMember(), ...
  • manipulate numbers: round(), floor(), ceiling(), pow(), ...
  • check and modify types: isReal(), isError(), int(), real()...
  • work with times: time(), formatTime(), interval(), ...
  • random: random(), $RANDOM_CHOICE(), $RANDOM_INTEGER(), ...
  • etc.

Check the documentation to see the complete list of predefined functions, and also the special macros.

How to ... work with nested loops? ^ Top

You can use $(Process) macro to simulate simple loops in the submit file and use the iterator to specify your arguments, input files, etc. However, sometimes simple loops are not enough and nested loops are needed. For example, assume you need to run your program with the arguments expressed in the next pseudocode:

 MAX_I = 8
 MAX_J = 5

 for (i = 0; i < MAX_I; i++)
   for (j = 0; j < MAX_J; j++)
     ./myprogram -var1=i -var2=j

To simulate these 2 nested loops, you will need to use next macros in your HTCondor submit file:

 MAX_I = 8 
 MAX_J = 5
 N = MAX_I * MAX_J
 I = ($(Process) / $(MAX_J))
 J = ($(Process) % $(MAX_J))
 executable = myprogram
 arguments  = "-var1=$INT(I) -var2=$INT(J)"
 queue $(N)

Last code will produce a nested loop where macro $(I) will work like the external iterator with values from 0 to 7; and $(J) will be the internal iterator with values from 0 to 4.

If you need to simulate 3 nested loops like the next ones:

 for (i = 0; i < MAX_I; i++)
   for (j = 0; j < MAX_J; j++)
     for (k = 0; k < MAX_K; k++)

then you can use the following expressions:

 N = $(MAX_I) * $(MAX_J) * $(MAX_K)

 I = ( $(Process) / ($(MAX_K)  * $(MAX_J)))
 J = (($(Process) /  $(MAX_K)) % $(MAX_J))
 K = ( $(Process) %  $(MAX_K))

 executable = myprogram
 arguments  = "-var1 $INT(I) -var2 $INT(J) -var3 $INT(K)" ...
 queue $(N)

How to ... program my jobs to begin at a predefined time? ^ Top

Sometimes you may want to submit your jobs, but those jobs should not begin at that moment (maybe because they depend on some input data that is automatically generated at any other time). You can use deferral_time command in your submit file to specify when your jobs should be executed. Time has to be specified in Unix epoch time (the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time), but, do not worry, there is a linux command to get this value:

  date --date "MM/DD/YYYY HH:MM:SS" +%s

For instance, we want to run a job on April 23rd, 2016 at 19:25. Then, the first step is to get the epoch time:

  [...]$ date --date "04/23/2016 19:25:00" +%s

Our value is 1461435900, so we only need to add next command to the submit file:

  deferral_time = 1461435900

Bear in mind that HTCondor will run jobs at that time according to remote machines, not yours. If there are wrong dates or times in remote machines, then your jobs could begin at other dates and/or times.

Also you can add expressions, like the next one to run your jobs one hour after the submission:

  deferral_time = (CurrentTime + 3600)

It may happen that your job could not begin exactly at that time (maybe it needs that some files are transferred and they are not ready yet), and in that case HTCondor may kill your job because the programmed time has expired and your job is not already running. To avoid that, you can specify a time window to begin the execution, a few minutes should be enough. For instance, add next command to tell HTCondor that your job could begin up to 3 minutes (180 seconds) after the programmed time:

  deferral_window = 180

Important: When you submit your programmed jobs, HTCondor will check which machines are able to run them and once the match is done, those machines will wait for the programmed time and will not accept any other jobs (actually, it will show Running status while waiting for the programmed time). That means a considerable loss of resources that should be always avoided. Using deferral_prep_time command we can specify that HTCondor could use those matched machines till some time before really running your jobs.

Then, add next lines to begin your jobs on April 23rd, 2016 at 19:25, specifying that they can begin up to 3 minutes after that date and that HTCondor could run other jobs on the matched machines till one minute before the programmed time:

  deferral_time      = 1461435900
  deferral_window    = 180
  deferral_prep_time = 60

HTCondor also allows you to use more powerful features, like specifying jobs that will be periodically executed at given times using the CronTab Scheduling functionality. Please, read the Time Scheduling for a Job Execution section in the official documentation to get more information.

How to ... run jobs that have dependencies among them? ^ Top

If your jobs have dependencies related to inputs, outputs, execution order, etc., you can specify these dependencies using a directed acyclic graph (DAG). HTCondor has a manager (called DAGMan) to deal with these jobs.

First, you have to create a DAG input file, where you specify the jobs (including the respective HTCondor submit file for each one) and the dependencies. Then, you submit this DAG input file using condor_submit_dag <dag_file>. Next code describes a basic example of DAG file where job A depends on B and C, that depend on D (diamond shape).

 # File name: diamond.dag
 JOB  A  condor_A.submit
 JOB  B  condor_B.submit 
 JOB  C  condor_C.submit	
 JOB  D  condor_D.submit

 [...]$ condor_submit_dag diamond.dag

Examples about working with HTCondor DAGMan can be found in the Official documentation mentioned above. You can also try the easy example located at the end of this page used in a course about HTCondor imparted by SIE some years ago (solution here).

How to ... know the attributes of the machines where our jobs are run? ^ Top

There is a special macro to get the string attributes of target machines that we can use in our submit file. In this way, some of the parameters of each machine where HTCondor executes jobs can be accessed with $$(parameter). Also there are other special macros, like the one used to print the symbol $ since it is reserved by HTCondor: $(DOLLAR).

For example, we want to know the name of each slot and machine where our jobs were executed, adding .$.name.$. to the results of stdout and stderr. Then we should use next commands:

 output        = myprogram.$(ID).$(DOLLAR).$$(Name).$(DOLLAR).out
 error         = myprogram.$(ID).$(DOLLAR).$$(Name).$(DOLLAR).err

Ading those commands in your submit file will create output and error files with names similar to $$.

Check also:

Section: HOWTOs