Skip to content

Commit f8d2fed

Browse files
samluryemeta-codesync[bot]
authored andcommitted
MONARCH_HYPERACTOR_UNAWAITED_PYTOKIO_TRACEBACK --> MONARCH_HYPERACTOR_ENABLE_UNAWAITED_PYTHON_TASK_TRACEBACK (#1718)
Summary: Pull Request resolved: #1718 Rename the environment variable ghstack-source-id: 320149421 exported-using-ghexport Reviewed By: vidhyav, mariusae Differential Revision: D85899714 fbshipit-source-id: 77b69080d19c9af81126e311a549137da4cd1f67
1 parent 422f466 commit f8d2fed

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

hyperactor/src/attrs.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ macro_rules! impl_attrvalue {
311311

312312
// Implement AttrValue for common standard library types
313313
impl_attrvalue!(
314-
bool,
315314
i8,
316315
i16,
317316
i32,
@@ -384,6 +383,24 @@ where
384383
}
385384
}
386385

386+
impl AttrValue for bool {
387+
fn display(&self) -> String {
388+
if *self { 1.to_string() } else { 0.to_string() }
389+
}
390+
391+
fn parse(value: &str) -> Result<Self, anyhow::Error> {
392+
let value = value.to_ascii_lowercase();
393+
match value.as_str() {
394+
"0" | "false" => Ok(false),
395+
"1" | "true" => Ok(true),
396+
_ => Err(anyhow::anyhow!(
397+
"expected `0`, `1`, `true` or `false`, got `{}`",
398+
value
399+
)),
400+
}
401+
}
402+
}
403+
387404
// Internal trait for type-erased serialization
388405
#[doc(hidden)]
389406
pub trait SerializableValue: Send + Sync {

hyperactor/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ mod tests {
334334
let expected_lines: HashSet<&str> = indoc! {"
335335
# export HYPERACTOR_MESSAGE_LATENCY_SAMPLING_RATE=0.01
336336
# export HYPERACTOR_CHANNEL_NET_RX_BUFFER_FULL_CHECK_INTERVAL=5s
337-
# export HYPERACTOR_CHANNEL_MULTIPART=true
337+
# export HYPERACTOR_CHANNEL_MULTIPART=1
338338
# export HYPERACTOR_DEFAULT_ENCODING=serde_multipart
339339
# export HYPERACTOR_REMOTE_ALLOCATOR_HEARTBEAT_INTERVAL=5s
340340
# export HYPERACTOR_STOP_ACTOR_TIMEOUT=10s

monarch_hyperactor/src/pytokio.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ declare_attrs! {
6969
/// If true, when a pytokio PythonTask fails, the traceback of the original callsite
7070
/// will be logged.
7171
@meta(CONFIG = ConfigAttr {
72-
env_name: Some("MONARCH_HYPERACTOR_UNAWAITED_PYTOKIO_TRACEBACK".to_string()),
73-
py_name: Some("unawaited_pytokio_traceback".to_string()),
72+
env_name: Some("MONARCH_HYPERACTOR_ENABLE_UNAWAITED_PYTHON_TASK_TRACEBACK".to_string()),
73+
py_name: Some("enable_unawaited_python_task_traceback".to_string()),
7474
})
75-
pub attr UNAWAITED_PYTOKIO_TRACEBACK: u8 = 0;
75+
pub attr ENABLE_UNAWAITED_PYTHON_TASK_TRACEBACK: bool = false;
7676
}
7777

7878
fn current_traceback() -> PyResult<Option<PyObject>> {
79-
if config::global::get(UNAWAITED_PYTOKIO_TRACEBACK) != 0 {
79+
if config::global::get(ENABLE_UNAWAITED_PYTHON_TASK_TRACEBACK) {
8080
Python::with_gil(|py| {
8181
Ok(Some(
8282
py.import("traceback")?
@@ -274,7 +274,7 @@ fn send_result(
274274
let tb = if let Some(tb) = traceback {
275275
format_traceback(py, &tb).unwrap()
276276
} else {
277-
"None (run with `MONARCH_HYPERACTOR_UNAWAITED_PYTOKIO_TRACEBACK=1` to see a traceback here)\n".into()
277+
"None (run with `MONARCH_HYPERACTOR_ENABLE_UNAWAITED_PYTHON_TASK_TRACEBACK=1` to see a traceback here)\n".into()
278278
};
279279
tracing::error!(
280280
"PythonTask errored but is not being awaited; this will not crash your program, but indicates that \

0 commit comments

Comments
 (0)