Hi 

I have a service that creates a multi job. It appears that there is only
an option to set the parent job's termination time and NOT the subjobs
of the multi. Currently I create each subjob (in a JobDescriptionType
object) and then they are added to a MultiJobDescriptionType which is
later associated with a CreateManagedJobInputType. The
CreateManagedJobInputType object then has its termination time set.
Setting this does not appear to set the termination time of the subjobs
- it ONLY sets the first subjob - is there a way to inherit or set the
termination time for ALL the subjobs? Am I using the wrong class or is
this a bug?

 

Regards

Ryan Fraser (SE)

CSIRO Exploration & Mining ,
ARRC, 26 Dick Perry Ave,
Kensington, WA 6151 Australia 
Phone +61 8 6436 8760 Fax +61 8 6436 8555

 

 

 

 

            private RunResponse submitBatchJob(

                  RunResponse rr, MultiJobDescriptionType
jobDescription,

                  int amountOfJobs) throws Exception

            

String gramJobHandle = null;

            SwFrameResource swFrameResource = getResource();

 

.........................

            // submit job

 

 

 

            try {

 

 

..........................

 

                  // prepare for job submission

                  JobDescriptionType[] jobs = jobDescription.getJob();

 

                  // set the default lifetime of the resource in seconds

                  //int lifetime =
(SwFrameConfig.defaultGramLifeTimeLength *
3600)+(int)(jobs[0].getMaxWallTime()/60);

                  int lifetime =
(SwFrameConfig.defaultGramLifeTimeLength * 3600);

                  logger.debug("Delegation Cert Resource lifetime in
seconds = " + lifetime);

                  lifetime = lifetime +
(int)(jobs[0].getMaxWallTime()/60);

                  logger.debug("Delegation Cert Resource lifetime in
seconds with walltime added = " + lifetime);

 

                  

                  // establish FULL delegation to client

            .......................................................

 

 

                  for(int i=0; i<amountOfJobs; i++)

                  {

                        jobs[i].setFactoryEndpoint(factoryEndpointSubs);

 
jobs[i].setJobCredentialEndpoint(credentialEndpoint);

 
jobs[i].setStagingCredentialEndpoint(credentialEndpoint);

 

                        TransferRequestType stageIn =
jobs[i].getFileStageIn();

 
stageIn.setTransferCredentialEndpoint(credentialEndpoint);

                        jobs[i].setFileStageIn(stageIn);

 

                        TransferRequestType stageOut =
jobs[i].getFileStageOut();

 
stageOut.setTransferCredentialEndpoint(credentialEndpoint);

                        jobs[i].setFileStageOut(stageOut);

 

                        DeleteRequestType fileCleanUp =
jobs[i].getFileCleanUp();

 
fileCleanUp.setTransferCredentialEndpoint(credentialEndpoint);

                        jobs[i].setFileCleanUp(fileCleanUp);

                  }

 

                  jobDescription.setFactoryEndpoint(factoryEndpoint);

                  jobDescription.setJob(jobs);

 

 
jobDescription.setJobCredentialEndpoint(credentialEndpoint);

                  //set the user cred for ANY staging

 
jobDescription.setStagingCredentialEndpoint(credentialEndpoint);

 

                  //set up calendar to detail termination time for the
resource we are about to create, this needs to be longer than the total
(including staging) job itself, resource for job

                  //will be destroyed at this time even if the job has
not completed!!!!

 

                  // set up calendar to detail termination time for the
resource

                  //    we are about to create, this needs to be longer
than the 

                  //    total (including staging) job itself, resource
for job will

                  //    be destroyed at this time even if the job has
not completed!

                  Calendar cal = Calendar.getInstance();

 
cal.add(java.util.Calendar.HOUR,100+(int)(jobs[0].getMaxWallTime()/60));

                  logger.debug("Resource lifetime is 100hrs + walltime =
" + (100+(int)(jobs[0].getMaxWallTime()/60)));

 

      

 

            

                  //set up calendar to detail termination time for the
resource we are about to create, this needs to be longer than the total
(including staging) job itself, resource for job

                  //will be destroyed at this time even if the job has
not completed!!!!

 

                  //subscibe to the job

                  Subscribe subscriptionReq = new Subscribe();

 

                  //create the job input which includes everything setup
previously

                  CreateManagedJobInputType jobInput = new
CreateManagedJobInputType();

                  jobInput.setJobID(new AttributedURI("uuid:" +
UUIDGenFactory.getUUIDGen().nextUUID()));

 

                  jobInput.setInitialTerminationTime(cal);

jobInput.setMultiJob(jobDescription);

                  //subscribe to the job

 

                  //create the job and submit to gram

                  CreateManagedJobOutputType createResponse

                  = factoryPort.createManagedJob(jobInput);

 

                  //create an endpoint to reference the job

                  EndpointReferenceType jobEndpoint =
createResponse.getManagedJobEndpoint();

 

                  ManagedJobPortType jobPort =
ManagedJobClientHelper.getPort(jobEndpoint);

 

 

 

 

Reply via email to