#![cfg_attr(feature = "macros", doc = include_str!("unit-authoring.md"))]
#![deny(missing_docs, rustdoc::broken_intra_doc_links)]
extern crate self as scientific_workflow;
#[cfg(test)]
#[cfg(feature = "runtime")]
mod composition;
#[cfg(feature = "runtime")]
mod error;
#[cfg(test)]
#[cfg(feature = "runtime")]
mod test_support;
#[cfg(feature = "runtime")]
pub mod config;
#[cfg(feature = "runtime")]
pub mod observation;
#[cfg(feature = "runtime")]
pub mod persistence;
#[cfg(feature = "runtime")]
pub mod prelude;
#[cfg(feature = "runtime")]
mod runtime;
#[cfg(feature = "runtime")]
pub use runtime::RuntimeError;
#[cfg(feature = "runtime")]
pub mod artifact;
#[cfg(feature = "runtime")]
pub mod campaign;
#[cfg(feature = "runtime")]
mod engine;
#[cfg(feature = "runtime")]
pub mod provenance;
#[cfg(feature = "runtime")]
pub mod registry;
#[cfg(feature = "runtime")]
pub mod seal;
#[cfg(feature = "runtime")]
pub mod state;
#[cfg(feature = "runtime")]
mod storage;
#[cfg(feature = "runtime")]
pub mod study;
#[cfg(feature = "runtime")]
pub mod task;
#[cfg(feature = "runtime")]
mod workspace;
#[cfg(feature = "runtime")]
pub use engine::RunHandle;
#[cfg(feature = "runtime")]
pub use error::WorkflowError;
#[cfg(feature = "macros")]
pub use scientific_workflow_macros::execution_unit;
#[cfg(feature = "runtime")]
pub use task::{
ExecutionUnit, InitializationContext, MemberCompletion, MemberView, SeedError, UnitResult,
};
#[cfg(feature = "runtime")]
pub fn run(project_root: &std::path::Path) -> Result<(), WorkflowError> {
engine::application(project_root)
}
#[cfg(feature = "runtime")]
pub fn check(input: &std::path::Path) -> Result<CheckReport, WorkflowError> {
if input.join("campaign.json").is_file() {
let plan = campaign::CampaignPlan::load(input)?;
plan.check()?;
return Ok(CheckReport {
kind: "campaign".into(),
studies: plan.studies().map(str::to_owned).collect(),
tasks: None,
threads: None,
});
}
let study = study::StudyPlan::load(input)?;
runtime::check_prerequisites(&study)?;
Ok(CheckReport {
kind: "study".into(),
studies: vec!["study".into()],
tasks: Some(study.plan_summary().phases().map(|p| p.tasks().len()).sum()),
threads: Some(study.threads()),
})
}
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
#[cfg(feature = "runtime")]
pub struct CheckReport {
pub kind: String,
pub studies: Vec<String>,
pub tasks: Option<usize>,
pub threads: Option<usize>,
}
#[cfg(feature = "runtime")]
pub fn start(input: &std::path::Path) -> Result<RunHandle, WorkflowError> {
engine::start(input)
}
#[cfg(feature = "runtime")]
pub fn open_run(
location: &artifact::StorageLocation,
id: &str,
) -> std::io::Result<artifact::RunArchive> {
artifact::RunArchive::open(location, id)
}
#[doc(hidden)]
#[cfg(feature = "runtime")]
pub mod __private {
pub use crate::task::ExecutionUnitRegistration;
pub use inventory;
}
#[cfg(feature = "runtime")]
pub fn seal_run(
location: &artifact::StorageLocation,
id: &str,
workspace: &std::path::Path,
reproducer: Option<&dyn seal::ReproductionRunner>,
) -> std::io::Result<seal::SealReport> {
seal::execute(location, id, workspace, reproducer)
}
#[cfg(feature = "runtime")]
pub fn reproduce_run(
location: &artifact::StorageLocation,
id: &str,
workspace: &std::path::Path,
) -> std::io::Result<seal::ReproductionEvidence> {
use seal::ReproductionRunner;
engine::CapturedReproducer {
workspace: workspace.into(),
}
.reproduce(&open_run(location, id)?)
}
#[cfg(feature = "runtime")]
pub fn seal_run_with_reproduction(
location: &artifact::StorageLocation,
id: &str,
workspace: &std::path::Path,
) -> std::io::Result<seal::SealReport> {
let runner = engine::CapturedReproducer {
workspace: workspace.join("reproduction-check"),
};
seal::execute(location, id, workspace, Some(&runner))
}
#[cfg(feature = "client")]
pub mod client;
#[cfg(feature = "protocol")]
pub mod protocol;
#[cfg(feature = "client")]
pub use client::RunClient;
#[cfg(feature = "python")]
mod python;