Difference: ClientApiCppDoc (6 vs. 7)

Revision 72011-07-11 - AlviseDorigo

Line: 1 to 1
 
META TOPICPARENT name="DevelopersDocumentation"

[ WORK IN PROGRESS ]

Line: 99 to 99
 

Proxy Delegation

In order to register a job, the user must previously delegate a proxy into the remote CREAM CE service. The procedure is a matter of a few steps:

Changed:
<
<
  • define an arbitrary string containing a delegation identifier (it will be used later as job parameter for registration of one or more jobs); please consider the importance of re-use a single delegation identifier for multiple job submissions; in fact the delegation process takes some time and can be a large overhead for the submission process
>
>
  • define an arbitrary string containing a delegation identifier (it will be used later as job parameter for registration of one or more jobs); please consider the importance of re-use a single delegation identifier for multiple job submissions; in fact the delegation process takes some time and can be a large overhead for the submission process
 
Line: 108 to 108
 

Job Registration

Changed:
<
<
The steps for the 'JobRegister operation are:
>
>
The steps for the JobRegister operation are:
 
  • Prepare one or more strings containing the JDL descriptions of one or more jobs to submit
  • Obtain a delegation identifier of a pre-delegated proxy (see Proxy Delegation)
  • Prepare one JobDescriptionWrapper object for each job to submit to the CREAM CE
Line: 118 to 118
 
  • Invoke the execute(...) method on the instance created above
  • Process the output
  • Delete the AbsCreamProxy instance
Changed:
<
<
The input and output arguments of the CreamProxyFactory::make_CreamProxyRegister(...) are a bit more complicated than in the case of the Proxy Delegation. As described in the API reference, the input and output arguments are:
>
>
The input and output arguments of the CreamProxyFactory::make_CreamProxyRegister(...) are a bit more complicated than in the case of the Proxy Delegation. As described in the API reference, the input and output arguments are pointers to:
  They are typedef for (respectively):
Changed:
<
<
>
>
 
  • std::map< std::string, boost::tuple< JobIdWrapper , std::string> >
Changed:
<
<
The first one is simply a C++ STL list where the user has to insert pointers to JobDescriptionWrapper objects; the second one is a complex structure based on the boost::tuple library. Each JobDescriptionWrapper object is built with a JobDescription identifier (an arbitrary string chosen by user) and other parameters that can been seen in example source code tryRegister.cpp. After the invocation of the execute(...) method, the second argument (passed to the CreamProxyFactory::make_CreamProxyRegister(...) function as output parameter) will be filled as follows:
>
>
The first one is simply a C++ STL list where the user has to insert pointers to JobDescriptionWrapper objects; the second one is a complex structure based on the boost::tuple library. Each JobDescriptionWrapper object is built with a JobDescription identifier (an arbitrary string chosen by user) and other parameters that can been seen in the example source code tryRegister.cpp. After the invocation of the execute(...) method, the second argument (passed to the CreamProxyFactory::make_CreamProxyRegister(...) function as output parameter) will be filled as follows:
 
  • The key of the map is the JobDescription identifier (as defined by the user)
Changed:
<
<
  • The value corresponding to the key is a boost::tuple;
>
>
  • The value corresponding to the key is a boost::tuple
 this tuple groups three elements:
  • The result of the operation, JobIdWrapper::RESULT
  • The Job (represented by a JobIdWrapper object, use the getCreamJobID method to obtain the Cream Job ID that you will need to start later)
  • A string representing an error message (non empty if the first element is different than JobIdWrapper::OK)
Changed:
<
<
As shown in the example source code tryRegister.cpp, a mandatory argument is autostart. In the example it is set to false; this means that the job is ONLY REGISTERED and NOT STARTED. Below it is explained the usefulness of autostart set to false. If she/he needs to start the job immediately after registration she/he can set to true the autostart parameter. An array of properties (implemented as a std::map < string, string >, i.e. couples key -> value ) is embedded in the JobIdWrapper object returned by JobRegister operation. At the moment the only relevant property returned by CREAM is the remote path in the CE the user can send its InputSandbox to.
>
>
As shown in the example source code tryRegister.cpp, a mandatory argument is autostart. In the example it is set to false; this means that the job is ONLY REGISTERED and NOT STARTED. Below it is explained the usefulness of autostart set to false. If she/he needs to start the job immediately after registration she/he can set to true the autostart parameter. An array of properties (implemented as a std::map < string, string >, i.e. couples key -> value ) is embedded in the JobIdWrapper object returned by JobRegister operation. At the moment the only relevant property returned by CREAM is the remote path in the CE the user can send its InputSandbox to, and name 'CREAMInputSandboxURI' (see again the example source code).
 
Changed:
<
<
  • Example code for single job submission is here
  • Example code for multiple job registration with a single remote call is here
>
>
  • Example code for single job submission is here
  • Example code for multiple job registration with a single remote call is here
 

Job start

Changed:
<
<
In the previous example, jobs are simply registered in the CREAM CE (autostart is set to false). This is useful if the user needs to do something between job registration and job start (e.g.: sending an input sandbox in the remote path specified by the CREAM CE for each job after the registration). To explicitly start a job the user must:
>
>
In the previous example, jobs are simply registered in the CREAM CE (autostart is set to false). This is useful if the user needs to do something between job registration and job start (e.g.: sending an input sandbox in the remote path specified by the CREAM CE). To explicitly start a job the user must:
 
  • Obtain the Cream Job IDs of the jobs to start (as result of JobRegister operation)
  • Build the JobIdWrapper object representing the jobs to start (one for each Cream Job ID to start)
Changed:
<
<
  • Define a time range (specified by two variables fromDate and toDate) which will allow her/him to only start the jobs that were registered in the time range [fromDate, toDate]
>
>
  • Define a time range (specified by two variables fromDate and toDate) which will allow her/him to only start the jobs that were registered in this time range [fromDate, toDate]
  To start all her/his jobs, the user has to use an empty vector of JobIdWrapper objects as argument of the JobFilterWrapper's costructor.
Added:
>
>

Cancelling, Suspending, Resuming and Purging jobs

The code for these four operations is basically the same. The user has to

The second argument of the factory methods is a pointer to a ResultWrapper object that will be filled-in with the results sent back by CREAM.

Like in the JobStart case, to cancel/suspend/resume/purge all her/his jobs, the user has to use an empty vector of JobIdWrapper objects as argument of the JobFilterWrapper's costructor.

The source code example is here. Please note that it is only for JobCancel operation; adapting it for the other three operations is straightforward.

Listing jobs in a CREAM CE

The code for listing all the jobs submitted to a CREAM CE is very simple; a few simple parameters are needed for the factory CreamProxyFactory_makeCreamProxyList(...). A look at the source code should be enough to understand what the user has to do.

Getting Information about jobs submitted to a CREAM CE

A user can invoke two operations to get information on one or more jobs submitted to a CREAM CE: JobInfo and JobStatus. The latter is quicker but provides less information than the former. In both cases the user must prepare a JobFilterWrapper object that collects all the identifier strings of the jobs to query and the conditions the jobs must satisfy in order to be included in the result. For example a user might need the query status of all jobs submitted between 8:00am and 15:00am of a particular day (if they were not purged out yet). Or she/he might need information on all the jobs that are in the "RUNNING" OR "DONE-OK" status... and so on. Please see the documentation of JobFilterWrapper to see what filters a user can define.

Fast info query (JobStatus)

With the invocation of the JobStatus remote operation CREAM will return a minimal set of information about the jobs: the current status of the job, the timestamp of the last status change, the exit code of the job and the failure reason (if the job finished or aborted). To query the states of some jobs, the user must prepare a JobFilterWrapper object and fill it with JobIdWrapper objects (one for each job to query) and with other constraints to select a particular set of jobs (see the JobFilterWrapper documentation).

As usual a user can query for the states of all her/his jobs; this can be achieved by using an empty vector of JobIdWrapper objects as argument of the JobFilterWrapper's costructor. See the CreamProxyFactory::make_CreamProxyStatus(...) and JobStatusWrapper documentation for more details about the structure of the information returned by CREAM.

As usual the example code is the best way to explain how it works.

Slow info query (JobInfo)

To get complete information about jobs the user must invoke the remote call JobInfo. The procedure is much similar to the fast call JobStatus: the user has to prepare a JobFilterWrapper object to select jobs and filters; then the result will be put in a JobInfoWrapper structure instead of a JobStatusWrapper. The data structure containing the output of the JobInfo operation is very similar to that one for the JobStatus operation. See the CreamProxyFactory::make_CreamProxyInfo(...) and JobInfoWrapper documentation for more details about the structure of the information returned by CREAM.

Example source code.

 [ TO BE CONTINUED ... ]

-- AlviseDorigo - 2011-06-14

 
This site is powered by the TWiki collaboration platformCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback