Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use relative filepaths in Job.create. #9

Merged
merged 9 commits into from
Jun 5, 2020
7 changes: 6 additions & 1 deletion src/main/java/org/vanvalenlab/FileJobManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
import ij.IJ;
import ij.plugin.PlugIn;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class FileJobManager extends KioskJobManager implements PlugIn {

public void run(String arg) {
try {
// Select the image file.
String filePath = IJ.getFilePath(Constants.SELECT_FILE_MESSAGE);
final String filePath = IJ.getFilePath(Constants.SELECT_FILE_MESSAGE);
if (filePath == null) return;

// show options menu (including hostname)
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/org/vanvalenlab/KioskJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import ij.IJ;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;

Expand Down Expand Up @@ -82,14 +83,15 @@ public String waitForFinalStatus(int updateInterval) throws IOException {
// START: HTTP API wrapper methods
/**
* Create the DeepCell Kiosk job.
* @param imageName The path of the image to process
* @param imageFilePath The path of the image to process
* @throws IOException
*/
public void create(String imageName) throws IOException {
String uploadPath = this.kioskClient.uploadFile(imageName);
public void create(String imageFilePath) throws IOException {
String uploadPath = this.kioskClient.uploadFile(imageFilePath);
if (null == uploadPath) {
throw new IOException(String.format("Failed to upload %s", imageName));
throw new IOException(String.format("Failed to upload %s", imageFilePath));
}
String imageName = (new File(imageFilePath)).getName();
String jobHash = this.kioskClient.createJob(imageName, uploadPath, this.jobType);
this.jobHash = jobHash;
}
Expand Down