Project

General

Profile

Creating a JobService issue

Added by Alanis Patricia over 12 years ago

Dear all,
I'm trying to submit a simple Hello World job using my job adaptor by doing something like this:

public class SagaJob {
public static void main(String[] args) throws Exception {
String[] attributes = { "Hello, World!" };
// used to generate JDL
JobDescription jobDesc = JobFactory.createJobDescription();
jobDesc.setAttribute(JobDescription.EXECUTABLE, "/bin/echo");
jobDesc.setVectorAttribute(JobDescription.ARGUMENTS, attributes);
URL urlService = URLFactory.createURL("ourgrid://patriciaam:8080");
// creating the job service
JobService ourgridService = JobFactory.createJobService(urlService);
// launch job
Job job = ourgridService.createJob(jobDesc);
// launch job
job.run();
// get id and check status periodically until done
System.out.println(job.getId());
boolean ok = false;
while (!job.waitFor(1) && !ok) {
System.out.println(job.getState());
// release the job
job.resume();
ok = true;
}
while (!job.waitFor(1)) {
System.out.println(job.getState());
// cancel the job
job.cancel();
}
System.out.println(job.getState());
}
}

But it gives me the following:
Exception in thread "main" NoSuccess: Found no job adaptor supporting type: ourgrid

If I try to create the job service without a URL, it gives me the next:
No protocol found in URL: ./
I just want to run some local tests, How can I do it without getting that?

PS. I have not filled properly the connecting and disconnecting methods. Is this related? If is related, how can I fill those methods ? Our scheduler at least for now does not need the connection method and also because it has not this connection concept.

Thanks in advance,
Patricia


Replies (7)

RE: Creating a JobService issue - Added by Reynaud Sylvain over 12 years ago

Dear Patricia,

This exception should occur for one the following causes :
  • your adaptor does not define the type "ourgrid" (method getType()).
  • your adaptor is not declared in file META-INF/adaptor.properties.
  • the jar file containing your adaptor is not in the classpath when your test is running.

For job adaptors, the connect methods is rarely used for connecting to a service, but it is the right place where to create the stub to invoke a web service for example, or to test if the service is available. Anyway, this is not related to your issue.

Regards,
Sylvain

RE: Creating a JobService issue - Added by Alanis Patricia over 12 years ago

Hi Sylvain,

Thanks a lot, it's working now but I have other issue when I run the job. If my thought is correct the JobDescription object should be translated into the kind of job that I need to submit on the grid. However, the JobDescription object arrives to the submit method as a String and I assumed that this string was the name of the translated job, but apparently it is not. What happens with the jobDescription after run the job and how I can recover what has been translated?

PS. At first I was testing directly using JSDL files but now I'm testing using JobDescription objects.

Regards,
Patricia

RE: Creating a JobService issue - Added by Schwarz Lionel over 12 years ago

Hi Patricia,
The String 'jobDesc' received as input parameter of the 'submit' method is not the name of the translated job, but rather its content. It is the responsibility of the 'submit' method to use this String to effectively submit the job.

AFAIK, once the job has been submitted, JSAGA does not keep trace of the string description (the string description has no meaning from the SAGA point of view).
Why would you need the String description?

Regards,
Lionel

RE: Creating a JobService issue - Added by Alanis Patricia over 12 years ago

Hi Sylvain,

So far as I understand the submit method receives the following:
jobDesc: the job description in the language supported by the targeted grid
checkMatch: if true then explicitly checks if job description matches job service before submitting job
uniqId: a identifier unique to this job (not the job identifier, which is not generated yet)
where in my case that jobDesc would be a jdf job to be submitted to the grid. Right? But the jobDesc String is only numbers like this:
ee130df4-ef5a-4b62-9c16-582f7d1de54c
and when I try to submit the job shows the following:
ee130df4-ef5a-4b62-9c16-582f7d1de54c.jsdl (No such file or directory)
Why does it happen that?

Regards,
Patricia

RE: Creating a JobService issue - Added by Schwarz Lionel over 12 years ago

Patricia, I'm Lionel not Sylvain ;)
Could you please send me the code of the submit method? to lionel.schwarz AT in2p3.fr
And also the full stacktrace?
Cheers
Lionel

RE: Creating a JobService issue - Added by Schwarz Lionel over 12 years ago

Patricia,
Your problem comes from your implementation of the submit method; you have indeed 2 problems:
1. You have switched 'jobDesc' and 'uniqId' input arguments, the signature of the JobControlAdaptor.submit is
public String submit(String jobDesc, boolean checkMatch, String uniqId) throws PermissionDeniedException, TimeoutException, NoSuccessException, BadResource;

2. You do not have to call yourself the translation. This is done by the JSAGA engine.
I do not quite understand why you implemented a specific class OurGridJobDescriptionTranslatorXSLT. In fact, you just have to declare your XSL as you did:

public JobDescriptionTranslator getJobDescriptionTranslator()
throws NoSuccessException {
JobDescriptionTranslator translator = new JobDescriptionTranslatorXSLT(
"xsl/job/jsdltranslator.xsl");
return translator;
}

and that's it. The jobDesc you get in the submit method (first parameter) is the result of this XSL transformation.
In you submit method, you can remove all code related to XSL transformation and write only:

nativeJobId = ourgridcommands.addJob(jobDesc);

and you can probably remove the class OurGridJobDescriptionTranslatorXSLT

Hope it helps
Lionel

RE: Creating a JobService issue - Added by Alanis Patricia over 12 years ago

Dear Lionel,

It's working!! Thanks a lot.

Cheers,
Patricia

    (1-7/7)