Skip to content

Commit

Permalink
chore: code review feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhuene committed Jan 14, 2025
1 parent 5a6b56b commit d589912
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions wdl-engine/src/backend/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use futures::future::BoxFuture;
use tokio::process::Command;
use tokio::sync::Semaphore;
use tracing::info;
use tracing::warn;
use wdl_analysis::types::PrimitiveType;
use wdl_ast::v1::TASK_REQUIREMENT_CPU;
use wdl_ast::v1::TASK_REQUIREMENT_MEMORY;
Expand Down Expand Up @@ -294,8 +295,15 @@ impl LocalTaskExecutionBackend {
/// If `max_concurrency` is `None`, the default available parallelism for
/// the host will be used (typically the logical CPU count).
pub fn new(max_concurrency: Option<usize>) -> Self {
let max_concurrency =
max_concurrency.unwrap_or_else(|| available_parallelism().map(Into::into).unwrap_or(1));
let max_concurrency = max_concurrency.unwrap_or_else(|| {
available_parallelism().map(Into::into).unwrap_or_else(|_| {
warn!(
"unable to determine available parallelism: tasks will not be executed \
concurrently"
);
1
})
});
Self {
lock: Semaphore::new(max_concurrency).into(),
max_concurrency,
Expand Down
6 changes: 5 additions & 1 deletion wdl-engine/src/eval/v1/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,11 @@ impl<'a> TaskEvaluator<'a> {

let ast = match document.node().ast() {
Ast::V1(ast) => ast,
_ => return Err(anyhow!("document is not a 1.x document").into()),
_ => {
return Err(
anyhow!("task evaluation is only supported for WDL 1.x documents").into(),
);
}
};

// Find the task in the AST
Expand Down
6 changes: 5 additions & 1 deletion wdl-engine/src/eval/v1/workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,11 @@ impl WorkflowEvaluator {

let ast = match document.node().ast() {
Ast::V1(ast) => ast,
_ => return Err(anyhow!("document is not a 1.x document").into()),
_ => {
return Err(
anyhow!("workflow evaluation is only supported for WDL 1.x documents").into(),
);
}
};

info!(
Expand Down

0 comments on commit d589912

Please sign in to comment.