-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
csuarez edited this page Aug 13, 2012
·
3 revisions
GridSessionConfig gridSessionConfig = generateGridSessionConfig("password");
int lifetime = 4 * 43200;
GliteProxyFactoryConfig gliteProxyFactoryConfig = new GliteProxyFactoryConfig(
gridSessionConfig,
lifetime,
"ceta");
GlobusCredential gliteProxy = GliteProxyFactory.generateGliteProxy(gliteProxyFactoryConfig);
//VO config
private static GridSessionConfig generateGridSessionConfig(String password) {
VOMSServerInfo vomsServerInfo = generateVOMSServerInfo();
GridSessionConfig gridSessionConfig = new GridSessionConfig();
gridSessionConfig.setProxyPath("proxyTest");
gridSessionConfig.addVOMSServer(vomsServerInfo);
gridSessionConfig.setVOMSCertDir("etc/certs/voms");
gridSessionConfig.setCertDir("etc/certs/ca");
gridSessionConfig.setUserKeyPass(password);
return gridSessionConfig;
}
private static VOMSServerInfo generateVOMSServerInfo() {
VOMSServerInfo vomsServerInfo = new VOMSServerInfo();
vomsServerInfo.setHostDn("/DC=es/DC=irisgrid/O=ceta-ciemat/CN=voms.ceta-ciemat.es");
vomsServerInfo.setHostName("voms.ceta-ciemat.es");
vomsServerInfo.setPort(15010);
vomsServerInfo.setVoName("ceta");
return vomsServerInfo;
}
MyProxy proxyServer = new MyProxy();
proxyServer.setHost("px-ceta-test.ceta-ciemat.es");
proxyServer.setPort(7512);
MyProxyService myProxyService = new MyProxyService(
proxyServer,
"MyProxyUser",
"MyProxyPassword");
myProxyService.registerProxy(gliteProxy, 7 * 24 * 3600);
GlobusCredential cred = myProxyService.retrieveProxy(7 * 24 * 3600);
CREAMService creamService = new CREAMService("https://ce-test.ceta-ciemat.es:8443/ce-cream/services");
String delegationId = creamService.delegateProxy(gliteProxy, 3600 * 1000 * 6);
JobDescription jobDescription = new JobDescription();
jobDescription.setDelegationId(delegationId);
jobDescription.setJDL(jdlAsString);
JobId jobId = creamService.registerJob(jobDescription);
Result resulstStartJob = creamService.startJob(jobId, delegationId);
Result resulstPauseJob = creamService.pauseJob(jobId, delegationId);
Result resultsResumeJob = creamService.resumeJob(jobId, delegationId);
Status jobStatus = creamService.jobStatus(jobId, delegationId).getJobStatus();
System.out.println("statusDescription=" + jobStatus.getDescription());
System.out.println("statusName=" + jobStatus.getName());
System.out.println("statusFailure=" + jobStatus.getFailureReason());
System.out.println("statusExitCode=" + jobStatus.getExitCode());
GridFTPService gridFTP = new GridFTPService("se-test.ceta-ciemat.es", 2811);
gridFTP.upload(gliteProxy, new byte[] {1, 2, 3, 4, 5} , "/tmp/destino");
byte[] content = gridFTP.download(gliteProxy, "/tmp/origen");
List<String> inputsToUpload = JDLCREAMUtils.getInputToUpload(jdlAsString);
for (String input : inputsToUpload) {
gridFTP.upload(gliteProxy, byteArray.get(input), input);
}
List<String> outputsToUpload = JDLCREAMUtils.getOutputToDownload(jdlAsString);
for (String output : outputsToUpload) {
byte[] content = gridFTP.download(gliteProxy, output);
}