Skip to content

Commit

Permalink
Merge pull request #2071 from joshmoore/final-inplace-fixes
Browse files Browse the repository at this point in the history
Final in-place fixes
  • Loading branch information
joshmoore committed Feb 10, 2014
2 parents 24d1283 + e999acf commit 02aae40
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 51 deletions.
102 changes: 56 additions & 46 deletions components/blitz/src/ome/formats/importer/cli/CommandLineImporter.java
Expand Up @@ -314,43 +314,47 @@ public static void usage() {
* Prints advanced usage to STDERR and exits with return code 1.
*/
public static void advUsage() {
System.err
.println(String
.format(
"\n"
+ "ADVANCED OPTIONS:\n\n"
+ " These options are not intended for general use. Make sure you have read the\n"
+ " documentation regarding them. They may change in future releases.\n\n"
+ " In-place imports:\n"
+ " -----------------\n\n"
+ " --transfer=ARG \tFile transfer method\n\n"
+ " General options: \t\n"
+ " -t upload \t# Default\n"
+ " -t some.class.Name \t# Use a class on the CLASSPATH\n\n"
+ " Server-side options:\t\n"
+ " -t ln \t# Use hard-link.\n"
+ " -t ln_s \t# Use symlnk.\n"
+ " -t ln_rm \t# Caution! Hard-link followed by source deletion.\n\n"
+ " --checksum_algorithm=ARG\tChoose a possibly faster algorithm for detecting file corruption\n"
+ " \tE.g. Adler-32 (fast), CRC-32 (fast), MD5-128\n"
+ " \t Murmur3-32, Murmur3-128, SHA1-160 (slow, default)\n\n"
+ "\n"
+ " ex. $ %s --transfer=ln_s --checksum_algorithm=CRC-32 foo.tiff\n"
+ "\n"
+ " Background imports:\n"
+ " -------------------\n\n"
+ " --minutes_wait=ARG \tChoose how long the importer will wait on server-side processing\n"
+ " \tARG > 0 implies the number of minutes to wait.\n"
+ " \tARG = 0 exits immediately. Use a *_completed option to clean up\n"
+ " \tARG < 0 waits indefinitely. This is the default\n\n"
+ " --close_completed \tClose completed imports\n\n"
+ " --wait_completed \tWait for all background imports to complete.\n\n"
+ "\n"
+ " ex. $ %s --minutes_wait=0 file1.tiff file2.tiff file3.tiff\n"
+ " $ %s --wait_completed # Waits on all 3 imports.\n"
+ "\n"
+ "Report bugs to <ome-users@lists.openmicroscopy.org.uk>",
APP_NAME, APP_NAME, APP_NAME));
System.err.println("\n"
+ "ADVANCED OPTIONS:\n\n"
+ " These options are not intended for general use. Make sure you have read the\n"
+ " documentation regarding them. They may change in future releases.\n\n"
+ " In-place imports:\n"
+ " -----------------\n\n"
+ " --transfer=ARG \tFile transfer method\n\n"
+ " General options: \t\n"
+ " upload \t# Default\n"
+ " some.class.Name \t# Use a class on the CLASSPATH.\n\n"
+ " Server-side options:\t\n"
+ " ln \t# Use hard-link.\n"
+ " ln_s \t# Use symlnk.\n"
+ " ln_rm \t# Caution! Hard-link followed by source deletion.\n\n"
+ "\n"
+ " ex. $ bin/omero import -- --transfer=ln_s foo.tiff\n"
+ " $ ./importer-cli --transfer=ln bar.tiff\n"
+ " $ CLASSPATH=mycode.jar ./importer-cli --transfer=com.example.MyTransfer baz.tiff\n"
+ "\n"
+ " Background imports:\n"
+ " -------------------\n\n"
+ " --minutes_wait=ARG \tChoose how long the importer will wait on server-side processing.\n"
+ " \tARG > 0 implies the number of minutes to wait.\n"
+ " \tARG = 0 exits immediately. Use a *_completed option to clean up.\n"
+ " \tARG < 0 waits indefinitely. This is the default.\n\n"
+ " --close_completed \tClose completed imports.\n\n"
+ " --wait_completed \tWait for all background imports to complete.\n\n"
+ "\n"
+ " ex. $ bin/omero import -- --minutes_wait=0 file1.tiff file2.tiff file3.tiff\n"
+ " $ ./importer-cli --minutes_wait=0 some_directory/\n"
+ " $ ./importer-cli --wait_completed # Waits on all 3 imports.\n"
+ "\n"
+ " Import speed:\n"
+ " -------------\n\n"
+ " --checksum_algorithm=ARG\tChoose a possibly faster algorithm for detecting file corruption,\n"
+ " \te.g. Adler-32 (fast), CRC-32 (fast), MD5-128,\n"
+ " \t Murmur3-32, Murmur3-128, SHA1-160 (slow, default)\n\n"
+ " ex. $ bin/omero import --checksum_algorithm=CRC-32 foo.tiff\n"
+ " $ ./importer-cli --checksum_algorithm=Murmur3-128 bar.tiff\n"
+ "\n"
+ "Report bugs to <ome-users@lists.openmicroscopy.org.uk>");
System.exit(1);
}

Expand Down Expand Up @@ -635,10 +639,21 @@ public static void main(String[] args) throws Exception {
((ch.qos.logback.classic.Logger)LoggerFactory
.getLogger("ome.formats")).getLevel()));

if (doCloseCompleted) {
System.exit(closeCompleted(config)); // EARLY EXIT!
} else if (doWaitCompleted) {
System.exit(waitCompleted(config)); // EARLY EXIT!
// Start the importer and import the image we've been given
String[] rest = new String[args.length - g.getOptind()];
System.arraycopy(args, g.getOptind(), rest, 0, args.length
- g.getOptind());

if (doCloseCompleted || doWaitCompleted) {
if (rest.length > 0) {
log.error("Files found with completed option: "+
Arrays.toString(rest));
System.exit(-2); // EARLY EXIT!
} else if (doCloseCompleted) {
System.exit(closeCompleted(config)); // EARLY EXIT!
} else if (doWaitCompleted) {
System.exit(waitCompleted(config)); // EARLY EXIT!
}
}

List<Annotation> annotations =
Expand All @@ -651,11 +666,6 @@ public static void main(String[] args) throws Exception {
}
config.annotations.set(annotations);

// Start the importer and import the image we've been given
String[] rest = new String[args.length - g.getOptind()];
System.arraycopy(args, g.getOptind(), rest, 0, args.length
- g.getOptind());

CommandLineImporter c = null;
int rc = 0;
try {
Expand Down
5 changes: 0 additions & 5 deletions components/tools/OmeroPy/src/omero/plugins/import.py
Expand Up @@ -70,10 +70,6 @@ def _configure(self, parser):
"-n", dest="java_n",
help="Image name to use (**)",
metavar="NAME")
parser.add_argument(
"-t", "--transfer", dest="java_transfer",
help="File transfer method to use (**)",
metavar="TRANSFER")
parser.add_argument(
"-x", dest="java_x",
help="Image description to use (**)",
Expand Down Expand Up @@ -166,7 +162,6 @@ def importer(self, args):
"java_ns": "--annotation_ns",
"java_text": "--annotation_text",
"java_link": "--annotation_link",
"java_transfer": "--transfer",
}

for attr_name, arg_name in java_args.items():
Expand Down

0 comments on commit 02aae40

Please sign in to comment.