http://ui.egee.creatis.insa-lyon.fr:8080/fgate/fgate.ph
lfn://lfc-biomed.in2p3.fr/grid/biomed/creatis/fgate/gasw/merge.xml
if(!input.endsWith(".tgz") && !input.endsWith(".tar.gz") && !input.endsWith(".tar") && !input.endsWith(".zip"))
throw(new Exception("Bad input format: "+input+" (must end with .tgz, .tar.gz, .tar or .zip)"));
input
stat
stopMonitoring.txt
lfn://lfc-biomed.in2p3.fr/grid/biomed/creatis/fgate/gasw/fgate.xml
try{
int nTot = Integer.parseInt(totalNPart);
int currentNPart = 0 ;
File stopMonitor = new File(fileStop);
while(nTot > currentNPart && !stopMonitor.exists()){
BufferedReader br = new BufferedReader(new FileReader(new File("./jobs.vljids")));
String s = "";
int totalNPart_ = 0;
while((s=br.readLine())!=null){
String[] elements = s.split(":",4);
if(elements.length!=4){
System.out.println("[monitorNParticles] Wrong job id format: "+s);
}
else{
String dir=elements[2];
String file=(new File(elements[3]).getName());
String fileName = dir+"/out/"+file+".std.out";
System.out.println("[monitorNParticles] Reading "+fileName);
try{
File f = new File(fileName);
BufferedReader brr = new BufferedReader(new FileReader(fileName));
String ss = "";
int tempNPart = 0;
int i =0;
while((ss=brr.readLine())!=null){
i++;
// System.out.println(ss);
if(ss.startsWith("# NumberOfEvents =")){
String[] el = ss.split("= ",2);
if(el.length!=2){
System.out.println("[monitorNParticles] Warning: wrong output line format at line "+i+": "+ss);
}
else{
el[1]=el[1].replace(" ","").trim();
if(!el[1].equals("")){
int n = Integer.parseInt(el[1]);
if(tempNPart > n)
System.out.println("[monitorNParticles] Inconsistent gate log at line "+i+": "+tempNPart+" > "+n);
else
tempNPart= n;
}
}
}
}
System.out.println("[monitorNParticles] "+tempNPart+" particles simulated in "+fileName);
String shFile = dir+"/failed/"+file;
File testFile = new File(shFile);
if(testFile.exists()){
System.out.println("[monitorNParticles] "+shFile+" is a failed job: ignoring particles");
}
else{
System.out.println("[monitorNParticles] "+shFile+" is not a failed job: adding particles");
totalNPart_ += tempNPart;
}
tempNPart=0;
}
catch(FileNotFoundException e){
System.out.println("[monitorNParticles] File "+fileName+ " does not exist: considering that no particle has been simulated by this task yet.");
}
}
}
currentNPart = totalNPart_;
System.out.println("[monitorNParticles] Current number of particles: "+currentNPart);
FileWriter fw = new FileWriter("npart.txt");
fw.write(currentNPart.toString());
fw.close();
Thread.currentThread().sleep(Integer.parseInt(sleepTime)*1000);
}
if(stopMonitor.exists())
System.out.println("[monitorNParticles] file "+fileStop+" exists");
System.out.println("[monitorNParticles] Current number of particles is "+currentNPart);
System.out.println("[monitorNParticles] Stopping monitoring");
}
catch(Exception e){
System.out.println("[monitorNParticles] Error: "+e.getMessage());
e.printStackTrace();
}
totalNPart
fileStop
sleepTime
(new File(file)).createNewFile();
file
output_lfn=new File(input_tgz_lfn).getParent()+"/output";
input_tgz_lfn
output_lfn
if(Integer.parseInt(in) >= Integer.parseInt(max)){
throw new Exception("Max number of seed ("+max+") has been reached");
}
else
seed=Integer.parseInt(in)+1;
max
seed
Runtime rt = Runtime.getRuntime();
String [] cmd1 = new String [4];
cmd1[0] = "wget";
cmd1[1] = url;
cmd1[2] = "--output-document";
cmd1[3] = "fgate.php";
Process p1 = rt.exec(cmd1);
p1.waitFor();
url
lfnDir=lfnDir.replace("lfn://","");
lfnDir=lfnDir.replace("lfn:/","");
lfnDir=lfnDir.replaceFirst("[a-z,A-Z,0-9,.,\\-,_]*/","/");
System.out.println("[createOutputDir] Directory to create: "+lfnDir );
Runtime rt = Runtime.getRuntime();
System.out.println("[createOutputDir] Testing existence of "+lfnDir);
String [] cmd1 = new String [3];
cmd1[0]="lfc-ls";
cmd1[1]="-d";
cmd1[2]= lfnDir;
Process p1 = rt.exec(cmd1);
p1.waitFor();
if(p1.exitValue()!=0){
System.out.println("[createOutputDir] Directory "+lfnDir+" does not exist: creating it");
cmd1[0] = "lfc-mkdir";
cmd1[1]="-p";
p1 = rt.exec(cmd1);
p1.waitFor();
if(p1.exitValue()!=0){
throw(new Exception("[createOutputDir] Unable to create directory "+lfnDir));
}
}
else
System.out.println("[createOutputDir] Directory "+lfnDir+" already exists");
lfnDir
Service definition of function ns__GASWexecution
http://egee1.unice.fr/wsdl/gasw_service_10_6.wsdl
GASWexecution
Service definition of function ns__GASWexecution
http://egee1.unice.fr/wsdl/gasw_service.wsdl
GASWexecution
Service definition of function ns__getNGateTask
http://ui.egee.creatis.insa-lyon.fr:8080/wsdl/gateTask_service.wsdl
getNGateTask
Completed
gate
merge
Scheduled
Running
Completed
testInputFormat
gate
Scheduled
Running
Completed
createOutputDir
gate
Scheduled
Running
Completed
gate
stopNParticlesMonitoring
Scheduled
Running