Specifying Output Files

Here are examples of how to get output files from your farm jobs.


  • Output File

This will copy an output file from the farm node after your job has finished.

PROJECT: MyProject
TRACK: MyTrack
JOBNAME: MyJob
COMMAND: ls -alF > file.out
OUTPUT_DATA: file.out
OUTPUT_TEMPLATE: /home/user/outdir/file.out

The XML version of this script looks like:

<Request>
  <Email email="user@jlab.org" request="false" job="true"/>
  <Project name="MyProject"/>
  <Track name="MyTrack"/>
  <Name name="MyJob"/>
  <Command><![CDATA[
   ls -alF > file.out
  ]]></Command>

  <Job>
    <Output src="file.out" dest="/home/user/outdir/file.out"/>
  </Job>

</Request>

  • Multiple Output Files

This will copy multiple output files from the farm node after your job has finished.

PROJECT: MyProject
TRACK: MyTrack
JOBNAME: MyJob
COMMAND: ls -alF > file.out; whoami > file2.out
OUTPUT_DATA: file.out
OUTPUT_TEMPLATE: /home/user/outdir/file.out
OUTPUT_DATA: file2.out
OUTPUT_TEMPLATE: /home/user/outdir/file2.out

The XML version of this script looks like:

<Request>
  <Email email="user@jlab.org" request="false" job="true"/>
  <Project name="MyProject"/>
  <Track name="MyTrack"/>
  <Name name="MyJob"/>
  <Command><![CDATA[
   ls -alF > file.out
   whoami > file2.out
  ]]></Command>

  <Job>
    <Output src="file.out" dest="/home/user/outdir/file.out"/>
    <Output src="file2.out" dest="/home/user/outdir/file2.out"/>
  </Job>

</Request>

  • Renaming Output File

This will copy an output file from the farm node after your job has finished and give it a new name.

PROJECT: MyProject
TRACK: MyTrack
JOBNAME: MyJob
COMMAND: ls -alF > file.out
OUTPUT_DATA: file.out
OUTPUT_TEMPLATE: /home/user/outdir/analysis.out

The XML version of this script looks like:

<Request>
  <Email email="user@jlab.org" request="false" job="true"/>
  <Project name="MyProject"/>
  <Track name="MyTrack"/>
  <Name name="MyJob"/>
  <Command><![CDATA[
   ls -alF > file.out
  ]]></Command>

  <Job>
    <Output src="file.out" dest="/home/user/outdir/analysis.out"/>
  </Job>

</Request>

  • Renaming Output File Based on Input File

This will copy an output file from the farm node after your job has finished and give it a new name which is based on the input name.

PROJECT: MyProject
TRACK: MyTrack
JOBNAME: MyJob
COMMAND: ls -alF > file.out
INPUT_FILES: 
/home/user/file1.dat 
/home/user/file2.dat
/home/user/file3.dat
/home/user/file4.dat
INPUT_DATA: infile
OUTPUT_DATA: file.out
OUTPUT_TEMPLATE: /home/user/outdir/*.out

The XML version of this script doesn't have a way to directly make an output name based on an input name, but you can use variables and lists, to accomplish the same thing.

<Request>
  <Email email="user@jlab.org" request="false" job="true"/>
  <Project name="MyProject"/>
  <Track name="MyTrack"/>
  <Name name="MyJob"/>
  <Command><![CDATA[
   ls -alF > file.out
  ]]></Command>

  <List name="files">
   file1.dat
   file2.dat
   file3.dat
   file4.dat
  </List>
  <ForEach list="files">
    <Job>
      <Input src="/home/user/${files}" dest="infile"/>
      <Output src="file.out" dest="/home/user/outdir/${files}.out"/>
    </Job>
  </ForEach>

</Request>

  • Renaming Multiple Output Files

This will copy multiple output files from the farm node after your job has finished and give then new names which are based on the input name.

PROJECT: MyProject
TRACK: MyTrack
JOBNAME: MyJob
COMMAND: ls -alF > file.out; whoami > file2.out
INPUT_FILES: 
/home/user/file1.dat 
/home/user/file2.dat
/home/user/file3.dat
/home/user/file4.dat
INPUT_DATA: infile
OUTPUT_DATA: file.out
OUTPUT_TEMPLATE: /home/user/outdir/*.out
OUTPUT_DATA: file2.out
OUTPUT_TEMPLATE: /home/user/outdir/*.log

The XML version of this script doesn't have a way to directly make an output name based on an input name, but you can use variables and lists, to accomplish the same thing.

<Request>
  <Email email="user@jlab.org" request="false" job="true"/>
  <Project name="MyProject"/>
  <Track name="MyTrack"/>
  <Name name="MyJob"/>
  <Command><![CDATA[
    ls -alF > file.out
    whoami > file2.out
  ]]></Command>

  <List name="files">
   file1.dat
   file2.dat
   file3.dat
   file4.dat
  </List>
  <ForEach list="files">
    <Job>
      <Input src="/home/user/${files}" dest="infile"/>
      <Output src="file.out" dest="/home/user/outdir/${files}.out"/>
      <Output src="file2.out" dest="/home/user/outdir/${files}.log"/>
    </Job>
  </ForEach>

</Request>

  • Output to Tape

To copy a file to tape using the flat file format, you just reference the file like any other file, using its /mss/... name.

PROJECT: MyProject
TRACK: MyTrack
JOBNAME: MyJob
COMMAND: ls -alF > file.out
OUTPUT_DATA: file.out
OUTPUT_TEMPLATE: /mss/home/user/outdir/file.out

In the XML version, you must precede the file name with mss:.

<Request>
  <Email email="user@jlab.org" request="false" job="true"/>
  <Project name="MyProject"/>
  <Track name="MyTrack"/>
  <Name name="MyJob"/>
  <Command><![CDATA[
   ls -alF > file.out
  ]]></Command>

  <Job>
    <Output src="file.out" dest="mss:/mss/home/user/outdir/file.out"/>
  </Job>

</Request>

  • Capturing STDOUT to a File

This is how you can have the standard output from your job sent to a file. Note that this can only be done in XML.

<Request>
  <Email email="user@jlab.org" request="false" job="true"/>
  <Project name="MyProject"/>
  <Track name="MyTrack"/>
  <Name name="MyJob"/>
  <Command><![CDATA[
   ls -alF
  ]]></Command>

  <Job>
    <Stdout dest="/home/user/outdir/file.out"/>
  </Job>

</Request>

  • Capturing STDERR to a File

This is how you can have the standard error from your job sent to a file. If you want both standard out and standard error captured, you just need to specify both a <Stdout> and a <Stderr> tag. Note that this can only be done in XML.

<Request>
  <Email email="user@jlab.org" request="false" job="true"/>
  <Project name="MyProject"/>
  <Track name="MyTrack"/>
  <Name name="MyJob"/>
  <Command><![CDATA[
    ls -alF
  ]]></Command>

  <Job>
    <Stderr dest="/home/user/outdir/file.out"/>
  </Job>

</Request>