Skip to content
Snippets Groups Projects
Commit 8f0a34c0 authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

refactoring

parent beacc8a4
No related branches found
No related tags found
No related merge requests found
......@@ -81,8 +81,6 @@ public class HaaSClient {
private String sessionID;
private Path workDirectory;
private UserAndLimitationManagementWsSoap userAndLimitationManagement;
private JobManagementWsSoap jobManagement;
......@@ -111,9 +109,8 @@ public class HaaSClient {
WS_STATE2STATE = Collections.unmodifiableMap(map);
}
public HaaSClient(Path workDirectory, Long templateId, Integer timeOut,Long clusterNodeType, String projectId) {
public HaaSClient(Long templateId, Integer timeOut,Long clusterNodeType, String projectId) {
super();
this.workDirectory = workDirectory;
this.templateId = templateId;
this.timeOut = timeOut;
this.clusterNodeType = clusterNodeType;
......@@ -181,7 +178,7 @@ public class HaaSClient {
}
}
public void download(long jobId) {
public void download(long jobId, Path workDirectory) {
try {
FileTransferMethodExt ft = getFileTransfer().getFileTransferMethod(jobId, getSessionID());
try (ScpClient scpClient = getScpClient(ft)) {
......
package cz.it4i.fiji.haas_java_client;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.rmi.RemoteException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
......@@ -14,11 +16,16 @@ import cz.it4i.fiji.haas_java_client.proxy.JobFileContentExt;
public class TestHaaSJavaClient {
public static void main(String[] args) throws RemoteException, ServiceException {
public static void main(String[] args) throws ServiceException, IOException {
Map<String, String> params = new HashMap<>();
params.put("inputParam", "someStringParam");
HaaSClient client = new HaaSClient(Paths.get("/home/koz01/aaa"), 1l,600, 7l,"DD-17-31");
Path baseDir = Paths.get("/home/koz01/aaa");
HaaSClient client = new HaaSClient( 1l,600, 7l,"DD-17-31");
long jobId = client.start(Arrays.asList(Paths.get("/home/koz01/aaa/vecmath.jar")), "TestOutRedirect", params.entrySet());
Path workDir = baseDir.resolve("" + jobId);
if (!Files.isDirectory(workDir)) {
Files.createDirectories(workDir);
}
JobInfo info;
do {
try {
......@@ -33,7 +40,7 @@ public class TestHaaSJavaClient {
}
client.downloadPartsOfJobFiles(jobId, taskFileOffset).forEach(jfc -> showJFC(jfc));
if (info.getState() == JobState.Finished) {
client.download(jobId);
client.download(jobId,workDir);
}
System.out.println("JobId :" + jobId + ", state" + info.getState());
} while (info.getState() != JobState.Canceled && info.getState() != JobState.Failed
......
package cz.it4i.fiji.haas_java_client;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.rmi.RemoteException;
import java.util.Collections;
import javax.xml.rpc.ServiceException;
......@@ -11,11 +12,16 @@ import cz.it4i.fiji.haas_java_client.proxy.JobFileContentExt;
public class TestHaaSJavaClientWithSPIM {
public static void main(String[] args) throws RemoteException, ServiceException {
HaaSClient client = new HaaSClient(Paths.get("/home/koz01/Work/vyzkumnik/fiji/work/aaa"), 2l, 9600, 6l,
"DD-17-31");
public static void main(String[] args) throws ServiceException, IOException {
HaaSClient client = new HaaSClient(2l, 9600, 6l, "DD-17-31");
Path baseDir = Paths.get("/home/koz01/Work/vyzkumnik/fiji/work/aaa");
long jobId = 36;// client.start(Collections.emptyList(), "TestOutRedirect",
// Collections.emptyList());
Path workDir = baseDir.resolve("" + jobId);
if (!Files.isDirectory(workDir)) {
Files.createDirectories(workDir);
}
JobInfo info;
boolean firstIteration = true;
do {
......@@ -33,7 +39,7 @@ public class TestHaaSJavaClientWithSPIM {
}
client.downloadPartsOfJobFiles(jobId, taskFileOffset).forEach(jfc -> showJFC(jfc));
if (info.getState() == JobState.Finished) {
client.download(jobId);
client.download(jobId, workDir);
}
System.out.println("JobId :" + jobId + ", state" + info.getState());
firstIteration = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment