Skip to main content

Job

Struct Job 

Source
pub struct Job { /* private fields */ }

Implementations§

Source§

impl Job

Source

pub fn from_uuid( _api_client: &ApiClient, uuid: &str, auth_token: Option<&str>, ) -> Result<Self>

Source

pub fn id(&self) -> &str

Examples found in repository?
examples/run_app.rs (line 78)
71fn _example_non_blocking() {
72    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
73
74    let mut job = app
75        .cli(None, None, None, false)
76        .expect("Failed to start job");
77
78    println!("Job ID: {}", job.id());
79    println!("Share link: {}", job.get_shareable_link());
80
81    job.wait(None).expect("Failed to wait for job");
82
83    let exit_code = job.get_exit_code().unwrap();
84    println!("Exit code: {exit_code}");
85}
Source

pub fn auth_token(&self) -> &str

Source

pub fn app_uri(&self) -> Option<&str>

Source

pub fn get_status(&mut self) -> Result<String>

Source

pub fn is_finished(&mut self) -> Result<bool>

Source

pub fn wait(&mut self, timeout: Option<u64>) -> Result<()>

Examples found in repository?
examples/run_app.rs (line 81)
71fn _example_non_blocking() {
72    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
73
74    let mut job = app
75        .cli(None, None, None, false)
76        .expect("Failed to start job");
77
78    println!("Job ID: {}", job.id());
79    println!("Share link: {}", job.get_shareable_link());
80
81    job.wait(None).expect("Failed to wait for job");
82
83    let exit_code = job.get_exit_code().unwrap();
84    println!("Exit code: {exit_code}");
85}
Source

pub fn get_stdout(&mut self) -> Result<Vec<u8>>

Examples found in repository?
examples/run_app.rs (line 10)
3fn main() {
4    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
5    println!("Loaded app: {}", app.uri());
6
7    let mut job = app.cli(None, None, None, true).expect("Failed to run app");
8
9    let exit_code = job.get_exit_code().expect("Failed to get exit code");
10    let stdout = job.get_stdout().expect("Failed to get stdout");
11    let stderr = job.get_stderr().expect("Failed to get stderr");
12
13    println!("Exit code: {exit_code}");
14    println!("Stdout: {}", String::from_utf8_lossy(&stdout));
15    if !stderr.is_empty() {
16        eprintln!("Stderr: {}", String::from_utf8_lossy(&stderr));
17    }
18
19    let files = job.list_output_files().expect("Failed to list files");
20    for file in &files {
21        println!("Output file: {}", file.path);
22    }
23}
24
25fn _example_with_args() {
26    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
27
28    let args = vec!["--name".to_string(), "World".to_string()];
29    let mut job = app
30        .cli(Some(args), None, None, true)
31        .expect("Failed to run app");
32
33    println!(
34        "Stdout: {}",
35        String::from_utf8_lossy(&job.get_stdout().unwrap())
36    );
37}
38
39fn _example_with_files() {
40    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
41
42    let mut files = HashMap::new();
43    files.insert("input.txt".to_string(), b"Hello from file".to_vec());
44
45    let mut job = app
46        .cli(None, None, Some(files), true)
47        .expect("Failed to run app");
48
49    let exit_code = job.get_exit_code().unwrap();
50    println!("Exit code: {exit_code}");
51
52    job.save_files("output_dir", true)
53        .expect("Failed to save files");
54}
55
56fn _example_search() {
57    let results = biolib::search(Some("hello"), None, 5).expect("Search failed");
58    for uri in &results {
59        println!("Found: {uri}");
60    }
61}
62
63fn _example_get_result() {
64    let job_id = "some-job-uuid";
65    let mut job = biolib::get_result(job_id, None).expect("Failed to get result");
66
67    let stdout = job.get_stdout().expect("Failed to get stdout");
68    println!("Stdout: {}", String::from_utf8_lossy(&stdout));
69}
Source

pub fn get_stderr(&mut self) -> Result<Vec<u8>>

Examples found in repository?
examples/run_app.rs (line 11)
3fn main() {
4    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
5    println!("Loaded app: {}", app.uri());
6
7    let mut job = app.cli(None, None, None, true).expect("Failed to run app");
8
9    let exit_code = job.get_exit_code().expect("Failed to get exit code");
10    let stdout = job.get_stdout().expect("Failed to get stdout");
11    let stderr = job.get_stderr().expect("Failed to get stderr");
12
13    println!("Exit code: {exit_code}");
14    println!("Stdout: {}", String::from_utf8_lossy(&stdout));
15    if !stderr.is_empty() {
16        eprintln!("Stderr: {}", String::from_utf8_lossy(&stderr));
17    }
18
19    let files = job.list_output_files().expect("Failed to list files");
20    for file in &files {
21        println!("Output file: {}", file.path);
22    }
23}
Source

pub fn get_exit_code(&mut self) -> Result<u16>

Examples found in repository?
examples/run_app.rs (line 9)
3fn main() {
4    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
5    println!("Loaded app: {}", app.uri());
6
7    let mut job = app.cli(None, None, None, true).expect("Failed to run app");
8
9    let exit_code = job.get_exit_code().expect("Failed to get exit code");
10    let stdout = job.get_stdout().expect("Failed to get stdout");
11    let stderr = job.get_stderr().expect("Failed to get stderr");
12
13    println!("Exit code: {exit_code}");
14    println!("Stdout: {}", String::from_utf8_lossy(&stdout));
15    if !stderr.is_empty() {
16        eprintln!("Stderr: {}", String::from_utf8_lossy(&stderr));
17    }
18
19    let files = job.list_output_files().expect("Failed to list files");
20    for file in &files {
21        println!("Output file: {}", file.path);
22    }
23}
24
25fn _example_with_args() {
26    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
27
28    let args = vec!["--name".to_string(), "World".to_string()];
29    let mut job = app
30        .cli(Some(args), None, None, true)
31        .expect("Failed to run app");
32
33    println!(
34        "Stdout: {}",
35        String::from_utf8_lossy(&job.get_stdout().unwrap())
36    );
37}
38
39fn _example_with_files() {
40    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
41
42    let mut files = HashMap::new();
43    files.insert("input.txt".to_string(), b"Hello from file".to_vec());
44
45    let mut job = app
46        .cli(None, None, Some(files), true)
47        .expect("Failed to run app");
48
49    let exit_code = job.get_exit_code().unwrap();
50    println!("Exit code: {exit_code}");
51
52    job.save_files("output_dir", true)
53        .expect("Failed to save files");
54}
55
56fn _example_search() {
57    let results = biolib::search(Some("hello"), None, 5).expect("Search failed");
58    for uri in &results {
59        println!("Found: {uri}");
60    }
61}
62
63fn _example_get_result() {
64    let job_id = "some-job-uuid";
65    let mut job = biolib::get_result(job_id, None).expect("Failed to get result");
66
67    let stdout = job.get_stdout().expect("Failed to get stdout");
68    println!("Stdout: {}", String::from_utf8_lossy(&stdout));
69}
70
71fn _example_non_blocking() {
72    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
73
74    let mut job = app
75        .cli(None, None, None, false)
76        .expect("Failed to start job");
77
78    println!("Job ID: {}", job.id());
79    println!("Share link: {}", job.get_shareable_link());
80
81    job.wait(None).expect("Failed to wait for job");
82
83    let exit_code = job.get_exit_code().unwrap();
84    println!("Exit code: {exit_code}");
85}
Source

pub fn list_output_files(&mut self) -> Result<Vec<OutputFile>>

Examples found in repository?
examples/run_app.rs (line 19)
3fn main() {
4    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
5    println!("Loaded app: {}", app.uri());
6
7    let mut job = app.cli(None, None, None, true).expect("Failed to run app");
8
9    let exit_code = job.get_exit_code().expect("Failed to get exit code");
10    let stdout = job.get_stdout().expect("Failed to get stdout");
11    let stderr = job.get_stderr().expect("Failed to get stderr");
12
13    println!("Exit code: {exit_code}");
14    println!("Stdout: {}", String::from_utf8_lossy(&stdout));
15    if !stderr.is_empty() {
16        eprintln!("Stderr: {}", String::from_utf8_lossy(&stderr));
17    }
18
19    let files = job.list_output_files().expect("Failed to list files");
20    for file in &files {
21        println!("Output file: {}", file.path);
22    }
23}
Source

pub fn save_files(&mut self, output_dir: &str, overwrite: bool) -> Result<()>

Examples found in repository?
examples/run_app.rs (line 52)
39fn _example_with_files() {
40    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
41
42    let mut files = HashMap::new();
43    files.insert("input.txt".to_string(), b"Hello from file".to_vec());
44
45    let mut job = app
46        .cli(None, None, Some(files), true)
47        .expect("Failed to run app");
48
49    let exit_code = job.get_exit_code().unwrap();
50    println!("Exit code: {exit_code}");
51
52    job.save_files("output_dir", true)
53        .expect("Failed to save files");
54}
Source

pub fn cancel(&mut self) -> Result<()>

Source

pub fn delete(&mut self) -> Result<()>

Source

pub fn rename(&mut self, name: &str) -> Result<()>

Examples found in repository?
examples/run_app.rs (line 79)
71fn _example_non_blocking() {
72    let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
73
74    let mut job = app
75        .cli(None, None, None, false)
76        .expect("Failed to start job");
77
78    println!("Job ID: {}", job.id());
79    println!("Share link: {}", job.get_shareable_link());
80
81    job.wait(None).expect("Failed to wait for job");
82
83    let exit_code = job.get_exit_code().unwrap();
84    println!("Exit code: {exit_code}");
85}
Source

pub fn stream_logs(&mut self) -> Result<()>

Source

pub fn start_in_cloud( _api_client: &ApiClient, app_uri: &str, app_version_uuid: &str, module_input: &[u8], override_command: bool, machine: Option<&str>, experiment_id: Option<&str>, result_prefix: Option<&str>, timeout: Option<u64>, notify: bool, requested_machine_count: Option<u32>, ) -> Result<Self>

Source

pub fn fetch_jobs( _api_client: &ApiClient, count: usize, status: Option<&str>, ) -> Result<Vec<Job>>

Auto Trait Implementations§

§

impl Freeze for Job

§

impl !RefUnwindSafe for Job

§

impl !Send for Job

§

impl !Sync for Job

§

impl Unpin for Job

§

impl UnsafeUnpin for Job

§

impl !UnwindSafe for Job

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more