Skip to content
Snippets Groups Projects
Commit 02897a4d authored by Fabio Hernandez's avatar Fabio Hernandez
Browse files

Add example with input and output files

parent a36ffeec
No related branches found
No related tags found
No related merge requests found
......@@ -65,9 +65,9 @@ Jobs processed: 1, successfully retrieved: 1, successfully cleaned: 1
## Submit, query and retreive your own jobs
The command [`arcsub`](https://www.nordugrid.org/arc/arc6/users/client_tools.html#arcsub) allows you to submit a job given its description. One of the job description languages supported by ARC6 is the **extended Resource Specification Language (xRSL)**, described [here](https://www.nordugrid.org/arc/arc6/users/xrsl.html). We will be using that language to describe the jobs we use in these examples.
The command [`arcsub`](https://www.nordugrid.org/arc/arc6/users/client_tools.html#arcsub) allows you to submit a job given its description. One of the job description languages supported by ARC6 is the **extended Resource Specification Language (xRSL)**, described [here](https://www.nordugrid.org/arc/arc6/users/xrsl.html). We will describe our example jobs using that language.
To submit a job which will execute `/usr/bin/env` and store its results in file `stdout` we can use the description included in file `arc-env.xrsl`:
File `arc-env.xrsl` contains the description of a job which executes `/usr/bin/env` and store its results in file `stdout`:
```bash
$ cat arc-env.xrsl
......@@ -77,7 +77,11 @@ $ cat arc-env.xrsl
( stdout = "stdout" )
( join = "yes" )
( gmlog = "gmlog" )
```
To submit this job use the command
```bash
$ arcsub -C $ARC_CE arc-env.xrsl
Job submitted with jobid: https://ccarccelsst01.in2p3.fr:9443/arex/lJPNDmDMZz0n3NnJ7oI0cbupABFKDmABFKDmbRGKDmFBFKDmAQSF3n
```
\ No newline at end of file
&( executable = "search-for-pattern.sh" )
( arguments = "bbb data.txt output.txt" )
( inputFiles =
( "data.txt" "" )
)
( outputFiles =
( "output.txt" "" )
)
( queue = "flash" )
( jobname = "arc-search-flash" )
( stdout = "stdout" )
( join = "yes" )
( gmlog = "gmlog" )
aaa
bbb
ccc
ddd
eee
fff
ggg
hhh
iii
jjj
\ No newline at end of file
#!/bin/bash
# Usage: search-for-pattern.sh <pattern> <input file> <output file>
thisScript=$(basename $0)
function usage() {
local name=$1
echo "Usage: ${name} <pattern> <input file> <output file> "
}
# Parse command line
pattern=$1
inputFile=$2
outputFile=$3
if [[ -z ${pattern} || -z ${inputFile} || -z ${outputFile} ]]; then
usage ${thisScript}
exit 1
fi
echo "Arguments: $*"
echo "Execution hostname: $(hostname -f)"
echo "Working directory: $(pwd)"
echo "Contents of working directory before execution:"
ls -al $(pwd)
# Ensure the input file exists
if [ ! -f ${inputFile} ]; then
echo "${thisScript}: could not find file ${inputFile} in working directory"
exit 1
fi
# Search pattern in input file and store the results in output file
grep "${pattern}" ${inputFile} > ${outputFile}
echo "Contents of working directory after execution:"
ls -al $(pwd)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment