constellation-rs / constellation

Distributed programming for Rust.
Apache License 2.0
563 stars 24 forks source link

Running the deploy binary without cargo #51

Closed fcharih closed 4 years ago

fcharih commented 4 years ago

Hi,

I have a Rust project with multiple binaries in a src/bin directory. I wish to run constellation with a specific executable compiled from src/bin/extractor-distrib.rs. My program takes arguments.

I cannot use cargo deploy directly because it doesn't know which binary to use, and I get

$ deploy 127.0.0.1:8888
Compiling rusty-sprint v0.1.0 (/home/mpiuser/rSPRINT)
    Finished dev [unoptimized + debuginfo] target(s) in 7.30s
thread 'main' panicked at 'assertion failed: bin.is_none()', /home/mpiuser/.cargo/registry/src/github.com-1ecc6299db9ec823/constellation-rs-0.1.8/src/bin/cargo-deploy.rs:55:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

When I try to run my program with deploy directly, my program is executed, but doesn't do anything without arguments.

$ deploy ./target/release/extractor-distrib 127.0.0.1:8888
8ba7c92:
   error: The following required arguments were not provided:
       --fasta <FILE>
       --output <FILE>

   USAGE:
       extractor-distrib --batch_size <INTEGER> --fasta <FILE> --kmer_size <INTEGER> --output <FILE> --t_hit <INTEGER> --t_sim <INTEGER>

   For more information try --help
   exited: Error(Unix(Status(1)))

... but it won't let me add argument:

$ deploy 127.0.0.1:8888 ./target/release/extractor-distrib -- -f sequences.fasta -o output.hsp
Invalid arguments.

USAGE:
    deploy [options] <host> <binary> [--] [args]...

Is there a way I can pass arguments to my program by running deploy directly. I figure the issue might jump into your face without much thought.

Cheers, Francois

alecmocatta commented 4 years ago

Thanks for the issue @flexplicateur! Constellation uses docopt here to handle command line arguments, and I got the docopt syntax slightly wrong such that the only argument it accepted is the string "args". I've pushed a fix (https://github.com/constellation-rs/constellation/pull/52/commits/25445a119d018341100f9af6d68f2cf42043b6d5) - a new version will be published in a couple of hours once it passes CI.

fcharih commented 4 years ago

Great! Thanks!

alecmocatta commented 4 years ago

And regarding using cargo deploy with multiple binaries – I've pushed a fix https://github.com/constellation-rs/constellation/pull/53 so that this should work:

cargo deploy --bin extractor-distrib 127.0.0.1:8888 -- -f sequences.fasta -o output.hsp
fcharih commented 4 years ago

Great work @alecmocatta . Thank you for this incredible library.