-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: model special resource requests too #512
Changes from all commits
0a7fae6
3415072
53d6b20
0a99f23
77d056d
7fd77f1
3fa5588
1cd3529
cbe9f1a
656a470
c905373
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
{ | ||
"command": [ | ||
"run_test.sh" | ||
], | ||
"expected_return": 1, | ||
"output_dir": "pipeline_test", | ||
"contains_only_files": [ | ||
"*" | ||
], | ||
"contents_match": [], | ||
"file_contains_string": [ | ||
{ | ||
"file": "SUM_SQUARES/SUM_SQUARES/fork0/chnk3/_stackvars", | ||
"string": "martian-rust/martian-lab/examples/sum_sq/src/sum_squares.rs:94" | ||
} | ||
] | ||
} | ||
"command": [ | ||
"run_test.sh" | ||
], | ||
"expected_return": 1, | ||
"output_dir": "pipeline_test", | ||
"contains_only_files": [ | ||
"*" | ||
], | ||
"contents_match": [ | ||
|
||
], | ||
"file_contains_string": [ | ||
{ | ||
"file": "SUM_SQUARES/SUM_SQUARES/fork0/chnk3/_stackvars", | ||
"string": "martian-rust/martian-lab/examples/sum_sq/src/sum_squares.rs:92" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,45 @@ | ||
0: anyhow::private::format_err | ||
at ./cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.51/src/lib.rs:659:13 | ||
1: <sum_sq::sum_squares::SumSquares as martian::stage::MartianStage>::main | ||
at ./martian-lab/examples/sum_sq/src/sum_squares.rs:94:24 | ||
2: <T as martian::stage::RawMartianStage>::main | ||
at ./martian/src/stage.rs:681:20 | ||
3: martian::martian_entry_point | ||
at ./martian/src/lib.rs:262:9 | ||
4: martian::MartianAdapter<S>::run_get_error | ||
at ./martian/src/lib.rs:164:9 | ||
5: martian::MartianAdapter<S>::run | ||
at ./martian/src/lib.rs:157:9 | ||
6: sum_sq::main | ||
at ./martian-lab/examples/sum_sq/src/main.rs:48:23 | ||
7: core::ops::function::FnOnce::call_once | ||
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:227:5 | ||
8: std::sys_common::backtrace::__rust_begin_short_backtrace | ||
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/sys_common/backtrace.rs:125:18 | ||
9: std::rt::lang_start::{{closure}} | ||
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:63:18 | ||
10: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once | ||
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:259:13 | ||
std::panicking::try::do_call | ||
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:401:40 | ||
std::panicking::try | ||
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:365:19 | ||
std::panic::catch_unwind | ||
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panic.rs:434:14 | ||
std::rt::lang_start_internal::{{closure}} | ||
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:45:48 | ||
std::panicking::try::do_call | ||
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:401:40 | ||
std::panicking::try | ||
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:365:19 | ||
std::panic::catch_unwind | ||
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panic.rs:434:14 | ||
std::rt::lang_start_internal | ||
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:45:20 | ||
11: std::rt::lang_start | ||
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:62:5 | ||
12: main | ||
13: __libc_start_main | ||
14: <unknown> | ||
at /sysdeps/x86_64/elf/start.S:103 | ||
0: anyhow::error::<impl anyhow::Error>::msg | ||
at /mnt/bazelbuild/user/preyas.shah/cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.86/src/backtrace.rs:27:14 | ||
1: anyhow::__private::format_err | ||
at /mnt/bazelbuild/user/preyas.shah/cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.86/src/lib.rs:689:13 | ||
2: <sum_sq::sum_squares::SumSquares as martian::stage::MartianStage>::main | ||
at /mnt/home/preyas/Reps/martian-rust/martian-lab/examples/sum_sq/src/sum_squares.rs:92:24 | ||
3: <T as martian::stage::RawMartianStage>::main | ||
at /mnt/home/preyas/Reps/martian-rust/martian/src/stage.rs:778:20 | ||
4: martian::martian_entry_point | ||
at /mnt/home/preyas/Reps/martian-rust/martian/src/lib.rs:261:9 | ||
5: martian::MartianAdapter<S>::run_get_error | ||
at /mnt/home/preyas/Reps/martian-rust/martian/src/lib.rs:165:9 | ||
6: martian::MartianAdapter<S>::run | ||
at /mnt/home/preyas/Reps/martian-rust/martian/src/lib.rs:158:9 | ||
7: sum_sq::main | ||
at /mnt/home/preyas/Reps/martian-rust/martian-lab/examples/sum_sq/src/main.rs:48:23 | ||
8: core::ops::function::FnOnce::call_once | ||
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:250:5 | ||
9: std::sys_common::backtrace::__rust_begin_short_backtrace | ||
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:155:18 | ||
10: std::rt::lang_start::{{closure}} | ||
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:159:18 | ||
11: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once | ||
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:284:13 | ||
12: std::panicking::try::do_call | ||
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40 | ||
13: std::panicking::try | ||
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19 | ||
14: std::panic::catch_unwind | ||
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14 | ||
15: std::rt::lang_start_internal::{{closure}} | ||
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:141:48 | ||
16: std::panicking::try::do_call | ||
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:559:40 | ||
17: std::panicking::try | ||
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:523:19 | ||
18: std::panic::catch_unwind | ||
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panic.rs:149:14 | ||
19: std::rt::lang_start_internal | ||
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:141:20 | ||
20: std::rt::lang_start | ||
at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/rt.rs:158:17 | ||
21: main | ||
22: __libc_start_main | ||
23: <unknown> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,25 +2,29 @@ | |
"chunks": [ | ||
{ | ||
"__mem_gb": 1, | ||
"__special": null, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be written if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
"__threads": 1, | ||
"__vmem_gb": null, | ||
"value": 1.0 | ||
}, | ||
{ | ||
"__mem_gb": 1, | ||
"__special": null, | ||
"__threads": 1, | ||
"__vmem_gb": null, | ||
"value": 2.0 | ||
}, | ||
{ | ||
"__mem_gb": 1, | ||
"__special": null, | ||
"__threads": 1, | ||
"__vmem_gb": null, | ||
"value": 3.0 | ||
} | ||
], | ||
"join": { | ||
"__mem_gb": null, | ||
"__special": null, | ||
"__threads": null, | ||
"__vmem_gb": null | ||
} | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -117,14 +117,16 @@ impl<T: MartianFileType> MartianMakePath for T { | |||||||||
/// | ||||||||||
/// Memory/ thread request can be negative in matrian. See | ||||||||||
/// [http://martian-lang.org/advanced-features/#resource-consumption](http://martian-lang.org/advanced-features/#resource-consumption) | ||||||||||
#[derive(Debug, Serialize, Deserialize, Copy, Clone, Default)] | ||||||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||||||||||
pub struct Resource { | ||||||||||
#[serde(rename = "__mem_gb")] | ||||||||||
mem_gb: Option<isize>, | ||||||||||
#[serde(rename = "__threads")] | ||||||||||
threads: Option<isize>, | ||||||||||
#[serde(rename = "__vmem_gb")] | ||||||||||
vmem_gb: Option<isize>, | ||||||||||
#[serde(rename = "__special")] | ||||||||||
special: Option<String>, | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This cannot be specified in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can be specified There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, to support it in the using section, we would need to update martian-rust/martian/src/mro.rs Line 657 in 7028107
martian-rust/martian-derive/src/lib.rs Line 392 in 7028107
#[make_mro(special="...")]
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should really be
Suggested change
There is no plausible use case for this being something other than a compile-time constant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (yes, I know this poses problems for deserialization but I can't think of a plausible case where you need to deserialize it either) |
||||||||||
} | ||||||||||
|
||||||||||
impl Resource { | ||||||||||
|
@@ -164,6 +166,11 @@ impl Resource { | |||||||||
self.threads | ||||||||||
} | ||||||||||
|
||||||||||
/// Get the special resource request | ||||||||||
pub fn get_special(&self) -> Option<String> { | ||||||||||
self.special.clone() | ||||||||||
preyasshah marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
} | ||||||||||
|
||||||||||
/// Set the mem_gb | ||||||||||
/// ```rust | ||||||||||
/// use martian::Resource; | ||||||||||
|
@@ -206,6 +213,21 @@ impl Resource { | |||||||||
self | ||||||||||
} | ||||||||||
|
||||||||||
/// Set the special request | ||||||||||
/// ```rust | ||||||||||
/// use martian::Resource; | ||||||||||
/// | ||||||||||
/// let resource = Resource::new().mem_gb(2).vmem_gb(4).special("gpu_count1_mem8".to_owned()); | ||||||||||
/// assert_eq!(resource.get_mem_gb(), Some(2)); | ||||||||||
/// assert_eq!(resource.get_vmem_gb(), Some(4)); | ||||||||||
/// assert_eq!(resource.get_threads(), None); | ||||||||||
/// assert_eq!(resource.get_special(), Some("gpu_count1_mem8".to_owned())); | ||||||||||
/// ``` | ||||||||||
pub fn special(mut self, special: String) -> Self { | ||||||||||
self.special = Some(special); | ||||||||||
self | ||||||||||
} | ||||||||||
|
||||||||||
/// Create a resource with the specified `mem_gb`. `vmem_gb` and | ||||||||||
/// `threads` are set to None. | ||||||||||
/// | ||||||||||
|
@@ -222,6 +244,7 @@ impl Resource { | |||||||||
mem_gb: Some(mem_gb), | ||||||||||
threads: None, | ||||||||||
vmem_gb: None, | ||||||||||
special: None, | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
|
@@ -241,6 +264,7 @@ impl Resource { | |||||||||
mem_gb: None, | ||||||||||
threads: Some(threads), | ||||||||||
vmem_gb: None, | ||||||||||
special: None, | ||||||||||
} | ||||||||||
} | ||||||||||
} | ||||||||||
|
@@ -609,7 +633,7 @@ pub trait MartianStage: MroMaker { | |||||||||
fill_defaults(resource), | ||||||||||
)) | ||||||||||
} | ||||||||||
let rover = _chunk_prelude(chunk_idx, run_directory, chunk.resource)?; | ||||||||||
let rover = _chunk_prelude(chunk_idx, run_directory, chunk.resource.clone())?; | ||||||||||
self.main(args.clone(), chunk.inputs.clone(), rover) | ||||||||||
}; | ||||||||||
|
||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was unneeded