Skip to content

Commit 400f818

Browse files
authored
do not panic if using alternate temp dir (#1332)
1 parent 1bc171e commit 400f818

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ballista/executor/src/executor_process.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,16 @@ pub async fn start_executor_process(
163163
let scheduler_port = opt.scheduler_port;
164164
let scheduler_url = format!("http://{scheduler_host}:{scheduler_port}");
165165

166-
let work_dir = opt
167-
.work_dir
168-
.clone()
169-
.unwrap_or(TempDir::new()?.path().to_str().unwrap().to_string());
166+
let work_dir = if let Some(work_dir) = opt.work_dir.clone() {
167+
work_dir
168+
} else if let Some(temp_dir) = TempDir::new()?.path().to_str().map(ToOwned::to_owned)
169+
{
170+
temp_dir
171+
} else {
172+
return Err(BallistaError::Configuration(
173+
"Unable to bind work dir".to_string(),
174+
));
175+
};
170176

171177
let concurrent_tasks = if opt.concurrent_tasks == 0 {
172178
// use all available cores if no concurrency level is specified

0 commit comments

Comments
 (0)