Skip to content

Commit

Permalink
feat: track finish state
Browse files Browse the repository at this point in the history
  • Loading branch information
hunjixin committed Aug 8, 2024
1 parent 88d2276 commit cb09a1c
Show file tree
Hide file tree
Showing 51 changed files with 1,029 additions and 442 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ Cargo.lock
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb


.vscode
dist/
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = [
"crates/dp_runner",
"crates/compute_unit_runner",
"crates/jiaozifs_client_rs", "nodes/jz_reader", "nodes/jz_writer", "nodes/dummy_in", "nodes/dummy_out"
, "nodes/copy_in_place"]
, "nodes/copy_in_place", "crates/nodes_sdk"]

[workspace.package]
repository = "https://github.com/GitDataAI/jz-action"
Expand Down Expand Up @@ -35,7 +35,7 @@ async-trait = "0.1.81"
futures = "0.3.30"
clap = {version="4.5.7", features=["derive"]}
actix-web = "4.8.0"
awc="3.5.0"
reqwest = {version="0.12.5", features=["json"]}

[package]
name = "jz_action"
Expand All @@ -50,14 +50,14 @@ k8s-openapi = { version = "0.22.0", features = ["latest"] }
handlebars = "6.0.0"
prost = "0.13.1"
serde_variant = "0.1.3"
uri="0.4.0"

tokio = { workspace = true, features = ["macros", "rt-multi-thread", "fs"] }
tokio-retry = {workspace = true}
tokio-stream = {workspace = true}
tokio-util= {workspace = true}

actix-web = {workspace = true}
awc= {workspace = true}
clap = {workspace = true}
uuid = {workspace = true}
anyhow = {workspace = true}
Expand All @@ -70,7 +70,7 @@ mongodb = {workspace = true}
chrono = {workspace = true}
futures = {workspace = true}
async-trait = {workspace = true}

reqwest = {workspace = true}

[build-dependencies]
tonic-build = "0.12.1"
Expand Down
2 changes: 2 additions & 0 deletions crates/compute_unit_runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ edition = "2021"

[dependencies]
jz_action = { path = "../../"}
nodes_sdk = {path = "../nodes_sdk"}

tokio = { workspace = true }
tokio-retry = {workspace = true}
Expand All @@ -23,6 +24,7 @@ async-trait = {workspace = true}
chrono = {workspace = true}
clap = {workspace = true}
futures = {workspace = true}
serde_repr = "0.1"

actix-web = "4.8.0"
hyperlocal = "0.9.1"
Expand Down
2 changes: 1 addition & 1 deletion crates/compute_unit_runner/dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM jz-action/net-debug
FROM ubuntu:22.04

WORKDIR /app

Expand Down
25 changes: 11 additions & 14 deletions crates/compute_unit_runner/src/bin/compute_unit_runner.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use compute_unit_runner::{
fs_cache::{
FSCache,
FileCache,
},
ipc,
media_data_tracker,
state_controller::StateController,
Expand All @@ -12,6 +8,10 @@ use jz_action::{
dbrepo::MongoRunDbRepo,
utils::StdIntoAnyhowResult,
};
use nodes_sdk::fs_cache::{
FSCache,
FileCache,
};

use anyhow::Result;
use clap::Parser;
Expand All @@ -26,13 +26,16 @@ use tokio::{
signal,
SignalKind,
},
sync::Mutex,
sync::{
Mutex,
RwLock,
},
task::JoinSet,
};

use nodes_sdk::monitor_tasks;
use tokio_util::sync::CancellationToken;
use tracing::{
error,
info,
Level,
};
Expand Down Expand Up @@ -94,7 +97,7 @@ async fn main() -> Result<()> {
);
program.run_backend(&mut join_set, token.clone())?;

let program_safe = Arc::new(Mutex::new(program));
let program_safe = Arc::new(RwLock::new(program));

let server = ipc::start_ipc_server(&args.unix_socket_addr, program_safe.clone()).unwrap();
let handler = server.handle();
Expand Down Expand Up @@ -142,11 +145,5 @@ async fn main() -> Result<()> {
token.cancel();
});
}

while let Some(Err(err)) = join_set.join_next().await {
error!("exit spawn {err}");
}

info!("gracefully shutdown");
Ok(())
monitor_tasks(&mut join_set).await
}
Loading

0 comments on commit cb09a1c

Please sign in to comment.