Skip to content

Commit

Permalink
fix: Properly report error happened in pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
chubei committed Nov 20, 2023
1 parent e98901f commit 9717fc8
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 175 deletions.
7 changes: 2 additions & 5 deletions dozer-cli/src/live/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,13 @@ fn run(
shutdown_receiver: ShutdownReceiver,
temp_dir: &str,
) -> Result<JoinHandle<()>, OrchestrationError> {
let mut dozer = get_dozer_run_instance(dozer, labels, request, temp_dir)?;
let dozer = get_dozer_run_instance(dozer, labels, request, temp_dir)?;

validate_config(&dozer.config)?;
let runtime = dozer.runtime.clone();
let run_thread = std::thread::spawn(move || dozer.run_all(shutdown_receiver, false));

let handle = std::thread::spawn(move || {
runtime.block_on(async {
run_thread.join().unwrap().unwrap();
});
runtime.block_on(async move { dozer.run_all(shutdown_receiver, false).await.unwrap() });
});

Ok(handle)
Expand Down
16 changes: 11 additions & 5 deletions dozer-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ fn run() -> Result<(), OrchestrationError> {
}
let config = config_res?;

let mut dozer = init_dozer(
let dozer = init_dozer(
runtime.clone(),
config.clone(),
LabelsAndProgress::new(Default::default(), cli.enable_progress),
Expand All @@ -172,19 +172,23 @@ fn run() -> Result<(), OrchestrationError> {
Commands::Run(run) => match run.command {
Some(RunCommands::Api) => {
render_logo();
dozer.run_api(shutdown_receiver)
dozer.runtime.block_on(dozer.run_api(shutdown_receiver))
}
Some(RunCommands::App) => {
render_logo();
dozer.run_apps(shutdown_receiver, None)
dozer
.runtime
.block_on(dozer.run_apps(shutdown_receiver, None))
}
Some(RunCommands::Lambda) => {
render_logo();
dozer.runtime.block_on(dozer.run_lambda(shutdown_receiver))
}
None => {
render_logo();
dozer.run_all(shutdown_receiver, run.locked)
dozer
.runtime
.block_on(dozer.run_all(shutdown_receiver, run.locked))
}
},
Commands::Security(security) => match security.command {
Expand All @@ -197,7 +201,9 @@ fn run() -> Result<(), OrchestrationError> {
Commands::Build(build) => {
let force = build.force.is_some();

dozer.build(force, shutdown_receiver, build.locked)
dozer
.runtime
.block_on(dozer.build(force, shutdown_receiver, build.locked))
}
Commands::Connectors(ConnectorCommand { filter }) => dozer.runtime.block_on(async {
let (abort_handle, registration) = AbortHandle::new_pair();
Expand Down
Loading

0 comments on commit 9717fc8

Please sign in to comment.