EGEE is a project funded by the European Union under contract IST EGEE Tutorial Turin - ITALY 18 – 19 January Job Services and Data Services Giuseppe La Rocca INFN Catania
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Overview Files on the RLS - Name Convention Job Description Language - Overview Relevant attributes JDL Examples Job without Data Requirements Job with Output Data Job with Input and Output Data Other examples using the lcg-* commands Bibliography Summary and Conclusions
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Files on the RLS - Name Convention Logical File Name 1 Logical File Name n GUID Physical File SURL n Physical File SURL Globally Unique Identifier (GUID) A non-human-readable unique identifier for a file, e.g. guid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6 Site URL (SURL) PFN/SFN Site URL (SURL) (or Physical/Site File Name (PFN/SFN)) The location of the actual file on a storage system, e.g. sfn://lxshare0209.cern.ch/data/alice/ntuples.dat Logical File Name (LFN) An alias created by a user to refer to some file, e.g. lfn:cms/track1 Transport URL (TURL) A temporary URL which can be used to access a particular data file contained in a Storage Element e.g. gsiftp://lxshare0209.cern.ch//data/alice/ntuples.dat
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Job Description Language (1) Job Description Language (JDL) In LCG-2 Job Description Language (JDL) are used to describe jobs for execution on Grid. CLASSified Advertisement language (ClassAd) The JDL adopted within the LCG-2 middleware is based upon Condors CLASSified Advertisement language (ClassAd). A ClassAd is a record-like structure composed of a finite number of attribute separated by semi-colon (;) A ClassAd is highly flexible and can be used to represent arbitrary services match- making process The JDL is used in LCG-2 to specify the desired job characteristics and constrains, which are used in by match- making process to select the resources that the job will use.
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, JDL syntax The JDL syntax consists on statements like: Attribute = value; # Comments must be preceded by a sharp character ( # ) or have to follow the C++ syntax WARING: The JDL is sensitive to blank characters and tabs. No blank characters or tabs should follow the semicolon at the end of a line. Job Description Language (2)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, In a JDL, some attributes are mandatory while others are optional. A essential JDL is the following: Executable = test.sh; StdOutput = std.out; StdError = std.err; InputSandbox = {test.sh}; OutputSandbox = {std.out,std.err}; If needed, arguments to the executable can be passed: Arguments = Hello World!; Job Description Language (3)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, If the arguments contains quoted strings, the quotes must be escaped with a backslash e.g. Arguments = \Hello World!\ 10; Special characters such as &, |, >, < are only allowed if specified inside a quoted string or preceded by triple \ (e.g. Arguments = "-f file1\\\&file2"; ) Job Description Language (4)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, The supported attributes are grouped in two categories: Job Attributes Define the job itself Resources Taken into account by the RB for carrying out the matchmaking algorithm (to choose the best resource where to submit the job) Computing Resource –Used to build expressions of Requirements and/or Rank attributes by the user –Have to be prefixed with other. Data and Storage resources –Input data to process, SE where to store output data, protocols spoken by application when accessing SEs Job Description Language (5)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, JDL: Relevant Attributes (1) JobType JobType (optional) Normal (simple, sequential job), Interactive, MPICH, Checkpointable, Partitionable Or combination of them Checkpointable, Interactive Checkpointable, MPI JobType = Interactive; E.g. JobType = Interactive; JobType = {Interactive,Checkpointable}; JobType = {Interactive,Checkpointable};
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Type Type (mandatory, default Job) This is a representing the type of the request described by the JDL. Possible values are: Job DAG Reservation Co-allocation Type = Job; E.g. Type = Job; JDL: Relevant Attributes (2)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Executable Executable (mandatory) This is a string representing the executable/command name. The user can specify an executable that lies already on the remote CE Executable = {/opt/EGEODE/GCT/egeode.sh}; The user can provide a local executable name, which will be staged from the UI to the WN. Executable = {egeode.sh}; InputSandbox = {/home/larocca/egeode/ InputSandbox = {/home/larocca/egeode/egeode.sh}; JDL: Relevant Attributes (3)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Arguments Arguments (optional) This is a string containing all the job command line arguments. E.g.: If your executable sum has to be started as: $ sum N1 N2 –out result.out Executable = sum; Executable = sum; Arguments = N1 N2 –out result.out; Arguments = N1 N2 –out result.out; JDL: Relevant Attributes (4)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Environment Environment (optional) List of environment settings needed by the job to run properly Environment = {JAVABIN=/usr/local/java}; E.g. Environment = {JAVABIN=/usr/local/java}; InputSandbox InputSandbox (optional) List of files on the UI local disk needed by the job for running The listed files will automatically staged to the remote resource InputSandbox ={myscript.sh,/tmp/cc,sh}; E.g. InputSandbox ={myscript.sh,/tmp/cc,sh}; JDL: Relevant Attributes (5)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, OutputSandbox OutputSandbox (optional) List of files, generated by the job, which have to be retrieved OutputSandbox ={ std.out, E.g. OutputSandbox ={ std.out, std.err, std.err, image.png}; image.png}; VirtualOrganisation VirtualOrganisation (optional) This is a string representing the name of the VO the submitting user is currently working for. VirtualOrganisation =gilda; E.g. VirtualOrganisation =gilda; JDL: Relevant Attributes (6)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Requirements Requirements (optional) Job requirements on computing resources Specified using attributes of resources published in the Information Service If not specified, default value defined in UI configuration file is considered Requirements = other.GlueCEStateStatus == "Production; Default. Requirements = other.GlueCEStateStatus == "Production; JDL: Relevant Attributes (7)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Rank Rank (optional) Floating-point expression used to ranks CEs that have already met the Requirements expression. The Rank expression can contain attributes that describe the CE in the Information System (IS). The evaluation of the rank expression is performed by the Resource Broker (RB) during the match-making phase. A higher numeric value equals a better rank. If not specified, default value defined in the UI configuration file is considered Rank = - other.GlueCEStateFreeCPUs; Default: Rank = - other.GlueCEStateFreeCPUs; JDL: Relevant Attributes (8)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, InputData InputData (optional) This is a string or a list of strings representing the Logical File Name (LFN) or Grid Unique Identifier (GUID) needed by the job as input. The list is used by the RB to find the CE from which the specified files can be better accessed and schedules the job to run there. InputData = {lfn:cmstestfile, guid:135b7b23-4a6a-11d7-87e7-9d101f8c8b70}; JDL: Relevant Attributes (9)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, DataAccessProtocol DataAccessProtocol (mandatory if InputData has been specified) The protocol or the list of protocols which the application is able to speak with for accessing files listed in InputData on a given SE. gridftpfile rfio Supported protocols in LCG-2 are currently gridftp, file and rfio. DataAccessProtocol = {file,gridftp,rfio}; JDL: Relevant Attributes (10)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, OutputSE OutputSE (optional) This string representing the URI of the Storage Element (SE) where the user wants to store the output data. This attribute is used by the Resource Broker to find a CE being close to this SE and schedule the job there. OutputSE = grid009.ct.infn.it; JDL: Relevant Attributes (11)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, OutputData OutputData (optional) This attribute allows the user to ask for the automatic upload and registration of datasets produced by the job on the Worker Node (WN). This attribute contains the following three attributes: OutputFile StorageElement LogicalFileName JDL: Relevant Attributes (12)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, OutputFile OutputFile (mandatory if OutputData has been specified) This is a string attribute representing the name of the output file, generated by the job on the WN, which has to be automatically uploaded and registered by the WMS. StorageElement StorageElement (optional) This is a string representing the URI of the Storage Element where the output file specified in the OutputFile has to be uploaded by the WMS. LogicalFileName LogicalFileName (optional) This is a string representing the LFN the user wants to associate to the output file when registering it to the Replica Catalogue. JDL: Relevant Attributes (13)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, OutputData = { [ OutputFile = dataset1.out; LogicalFileName = lfn:test-result1; ],[ OutputFile = dataset2.out; LogicalFileName = lfn:test-result2; StorageElement = grid009.ct.infn.it; ],[ OutputFile = dataset3.out; OutputFile = dataset3.out;]}; JDL: Relevant Attributes (14)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Examples
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Job Without Data Requirements(1) [ Type = job; JobType = Normal; Executable = "script.sh"; Arguments = Giuseppe; StdOutput = sim.out; StdError = sim.err; InputSandbox = {"script.sh"}; OutputSandbox = {sim.err,sim.out};
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, # A site with more than 4 CPU is required. Requirements=(other.GlueCEInfoTotalCPUs>4); # If more than one resource matches, the resource with the largest # number of CPU is chosen. Rank = (other.GlueCEStateFreeCPUs); ] Job Without Data Requirements(2)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, script.sh #!/bin/sh /bin/echo Hello $1 and Welcome to the EGEE Tutorial!
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Examples
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Job with Output Data (1) [ Type = job; JobType = Normal; Executable = scriptOutput.sh"; Arguments = Giuseppe; VirtualOrganisation = gilda; StdOutput = sim.out; StdError = sim.err; InputSandbox = {"scriptOutput.sh"};
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, OutputSandbox = {sim.err, sim.out}; OutputData = { [ Outputfile = TorinoXX.out; LogicalName = lfn:TorinoXX.out; StorageElement = grid009.ct.infn.it; ]}; Requirements=(other.GlueCEInfoTotalCPUs>4); Rank=(other.GlueCEStateFreeCPUs); RetryCount = 0; ] Job with Output Data (2)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, scriptOutput.sh #!/bin/sh /bin/echo Hello $1 and Welcome to the EGEE Tutorial! > TorinoXX.out
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Examples
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Job with Input Data (1) [ Type = job; JobType = Normal; Executable = scriptInput.sh"; Arguments = Francesco; VirtualOrganisation = gilda; StdOutput = std.out; StdError = std.err;
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, InputSandbox = {scriptInput.sh"}; OutputSandbox = {std.err, std.out}; InputData = lfn:myoutdata.1; DataAccessProtocol = {gridftp,rfio}; Requirements=(other.GlueCEInfoTotalCPUs>4); Rank=(other.GlueCEStateFreeCPUs); RetryCount = 0; ] Job with Input Data (2)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, scriptInput.sh #!/bin/sh lcg-cp –vo gilda lfn:myoutdata.1 file:`pwd`/dataset1.out echo Before updating.. cat dataset1.out #Adding new entry on the dataset1.out file. /bin/echo Hello $1 and Welcome to the EGEE Tutorial! >> dataset1.out echo After updating.. cat dataset1.out
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Examples
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, StoreData.jdl Type="Job"; JobType="Normal"; StoreData.sh Executable="StoreData.sh"; myfile myfile grid009.ct.infn.it Arguments="myfile myfile grid009.ct.infn.it"; VirtualOrganisation="gilda"; StdOutput="std.out"; StdError="std.err"; StoreData.sh InputSandbox={"StoreData.sh","myfile"}; OutputSandbox={"std.out","std.err"}; Requirements=(other.GlueCEInfoTotalCPUs > 4); Rank=other.GlueCEStateFreeCPUs;
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, #!/bin/sh ARGS=3 ERROR_BADARGS=10# Bad arguments error ERROR_FILE=20# File to copy on RLS doesn't exist ERROR_STORAGE=30# Storage Element doesn't exist in this Catalog. # Check for proper no. of command line args. if [ $# -ne $ARGS ] then echo "Usage: `basename $0` [text-file2copy] [lfn-file2copy] [se- name]" exit $ERROR_BADARGS StoreData.sh (1)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, else # Setting the variables for the script. FILE2COPY=$1 LFN2COPY=$2 SENAME=$3 fi # Check if the ${FILE2COPY} exists on the path. if [ ! -e `pwd`/${FILE2COPY} ] then echo "Error: `basename $0.` ${FILE2COPY} does not exist on the path." exit ${ERROR_FILE} fi StoreData.sh (2)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, # Checking if the SENAME is a good SE where to store data. lcg-infosites --vo gilda closeSE | grep ${SENAME} if [ $? -eq 0 ] then # Uploading the copy on the RLS. lcg-cr --vo gilda -d ${SENAME} -l ${LFN2COPY} file:`pwd`/${FILE2COPY} else echo Sorry, but you have to specific a good Storage Element. exit $ERROR_STORAGE fi StoreData.sh (3)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Type="Job"; JobType="Normal"; UpdateData.sh Executable=UpdateData.sh"; myfile Julia grid009.ct.infn.it Arguments="myfile Julia grid009.ct.infn.it"; VirtualOrganisation="gilda"; StdOutput="std.out"; StdError="std.err"; UpdateData.sh InputSandbox={UpdateData.sh"}; OutputSandbox={"std.out","std.err"}; Requirements=(other.GlueCEInfoTotalCPUs > 4); Rank=other.GlueCEStateFreeCPUs; UpdateData.jdl
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, UpdateData.sh (1) #!/bin/sh ARGS=3 ERROR_BADARGS=10# Bad arguments error. ERROR_BADLFN=20# LFN doesn't exist on the RLS. ERROR_BADSTORAGE=30# Storage Element doesn't exist in this Catalog. # Check for proper no. of command line args. if [ $# -ne $ARGS ] then echo "Usage: `basename $0` [lfn-file2copy] [argument] [se-name]" exit ${ERROR_BADARGS} else # Setting the arguments for the script. LFN2RETRIEVE=$1 ARGUMENT=$2 SENAME=$3 fi
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, # Check if the ${LFN2RETRIEVE} exists on the RLS. lcg-lr --vo gilda lfn:${LFN2RETRIEVE} if [ $? -eq 1 ] then echo "Sorry, but the LFN that you have specified does not exists on the RLS". exit ${ERROR_BADLFN} else # Retrieve the file from the catalog... lcg-cp --vo gilda lfn:${LFN2RETRIEVE} file:`pwd`/myfile #...adding new data to myfile. echo Hello ${ARGUMENT} and Welcome to the EGEE Tutorial!! >> `pwd`/myfile fi # Checking if the SENAME is a good SE where to store data. lcg-infosites --vo gilda closeSE | grep ${SENAME} UpdateData.sh (2)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, if [ $? -eq 1 ] then echo Sorry, but you have to specific a good Storage Element. exit ${ERROR_STORAGE} else # Setting the variables for the new copy. FILE2COPY=`pwd`/myfile LFN2COPY=${LFN2RETRIEVE} # Removing the old copy form the RLS... lcg-del --vo gilda -a lfn:${LFN2COPY} #... and staging the new data on the RLS. lcg-cr --vo gilda -d ${SENAME} -l ${LFN2COPY} file:${FILE2COPY} echo "Your data has been correctly uploaded to the RLS. echo Have a nice day!!" fi UpdateData.sh (3)
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, JDL Attributes LCG-2 User Guide Manual Series EDG Tutorial EDG Users Guide
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Summary & Conclusions We explained the main attributes to create and submit basic JDL on the GRID. Jobs which interacts with the RLS through the JDL Jobs which interacts with the RLS using the lcg-* commands.
EGEE Tutorial – Turin – Job Services and Data Services – January 18-19, Questions…