Idk i should rly commit when i am done and not 2 days later
All checks were successful
/ build (push) Successful in 1m16s
/ clippy (push) Successful in 1m21s

This commit is contained in:
xqtc 2024-09-17 16:56:52 +02:00
parent a6524106b8
commit c677a142dd
6 changed files with 21 additions and 18 deletions

View file

@ -5,11 +5,11 @@
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1725234343, "lastModified": 1726153070,
"narHash": "sha256-+ebgonl3NbiKD2UD0x4BszCZQ6sTfL4xioaM49o5B3Y=", "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "567b938d64d4b4112ee253b9274472dc3a346eb6", "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -20,11 +20,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1725103162, "lastModified": 1726243404,
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=", "narHash": "sha256-sjiGsMh+1cWXb53Tecsm4skyFNag33GPbVgCdfj3n9I=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b", "rev": "345c263f2f53a3710abe117f28a5cb86d0ba4059",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -10,10 +10,10 @@ run *ARGS:
cargo run {{ARGS}} cargo run {{ARGS}}
head-node *ARGS: head-node *ARGS:
cargo run --bin head-node cargo run --bin head-node --features="head"
worker-node *ARGS: worker-node *ARGS:
cargo run --bin worker-node cargo run --bin worker-node --features="worker"
# Run 'cargo watch' to run the project (auto-recompiles) # Run 'cargo watch' to run the project (auto-recompiles)
watch *ARGS: watch *ARGS:

View file

@ -2,7 +2,7 @@ mod util;
use std::{collections::HashMap, sync::RwLock}; use std::{collections::HashMap, sync::RwLock};
use crate::config::CONFIG; use crate::util::config::CONFIG;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use log::{debug, info}; use log::{debug, info};
use sched::AliveCheckRequest; use sched::AliveCheckRequest;
@ -62,9 +62,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
} }
let addr = "[::1]:50051".parse()?; let addr = "[::1]:50051".parse()?;
info!("Starting gRPC server on {}", addr); info!("Starting gRPC server on {}", addr);
let data = grpc::DataService::default(); let data = crate::util::grpc::DataService::default();
let auth = grpc::AuthService::default(); let auth = crate::util::grpc::AuthService::default();
let alive = grpc::AliveCheckService::default(); let alive = crate::util::grpc::AliveCheckService::default();
let grpc_server = Server::builder() let grpc_server = Server::builder()
.add_service(sched::data_server::DataServer::new(data)) .add_service(sched::data_server::DataServer::new(data))
.add_service(sched::auth_server::AuthServer::new(auth)) .add_service(sched::auth_server::AuthServer::new(auth))

View file

@ -5,10 +5,13 @@ use crate::sched::{
}; };
use log::{debug, info}; use log::{debug, info};
pub mod sched {
tonic::include_proto!("sched");
}
#[cfg(feature = "head")] #[cfg(feature = "head")]
use crate::state::STATE; use crate::util::state::STATE;
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct DataService {} pub struct DataService {}

View file

@ -1,3 +1,5 @@
use std::{collections::HashMap, sync::RwLock };
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref STATE: RwLock<State> = RwLock::new(State { pub static ref STATE: RwLock<State> = RwLock::new(State {
@ -7,7 +9,6 @@ lazy_static::lazy_static! {
} }
pub struct Node { pub struct Node {
pub id: String,
pub specs: NodeSpecs, pub specs: NodeSpecs,
pub curr_job: Task, pub curr_job: Task,
pub job_queue: JobQueue, pub job_queue: JobQueue,

View file

@ -2,10 +2,9 @@ use std::{
net::SocketAddr, net::SocketAddr,
sync::{atomic::AtomicBool, Arc}, sync::{atomic::AtomicBool, Arc},
}; };
mod grpc; mod util;
mod config; use crate::util::config::CONFIG;
use crate::config::CONFIG;
use log::{debug, error, info}; use log::{debug, error, info};
use sched::{DataRequest, LoginRequest, LogoutRequest}; use sched::{DataRequest, LoginRequest, LogoutRequest};