Skip to content

Commit

Permalink
Inherit Dependencies (#91)
Browse files Browse the repository at this point in the history
* Inherit dependencies from main `Cargo.toml` file.

* Update file paths.

* Update Cargo.toml

Co-authored-by: Dan Nixon <[email protected]>

* Update Cargo.toml

Co-authored-by: Dan Nixon <[email protected]>

* Update Cargo.toml

Co-authored-by: Dan Nixon <[email protected]>

* Undo autoformat.

* Inherit all singleton dependencies.

* Prefix `supermusr-` and sort alphabetically.

* Update package names.

* Update all references to `common`.

* Fix hyphens.

* Update names.

* Sort imports alphabetically.

* Revert alphabetical order for anti-example.

---------

Co-authored-by: Dan Nixon <[email protected]>
  • Loading branch information
Henry-Denny and DanNixon authored Dec 4, 2023
1 parent 81165ae commit 68560d8
Show file tree
Hide file tree
Showing 43 changed files with 189 additions and 163 deletions.
66 changes: 33 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,27 @@ edition = "2021"

[workspace.dependencies]
anyhow = "1.0"
chrono = "0.4.31"
assert_approx_eq = "1.1.0"
async-trait = "0.1.68"
chrono = "0.4.22"
clap = { version = "4.4", features = ["derive", "env"] }
crossterm = "0.26.1"
env_logger = "0.10"
flatbuffers = "22.12.6"
hdf5 = "0.8.1"
itertools = "0.11.0"
kagiyama = "0.3.0"
lazy_static = "1.4.0"
log = "0.4"
ndarray = "0.15.6"
ndarray-stats = "0.5.1"
rdkafka = { version = "0.31.0", features = ["cmake-build", "ssl", "gssapi", "sasl"] }
num = "0.4.1"
rand = "0.8.5"
ratatui = "0.22.0"
rayon = "1.8.0"
rdkafka = { version = "0.31.0", features = [ "cmake-build", "ssl", "gssapi", "sasl", ] }
serde = { version = "1", features = ["derive"] }
supermusr-common = { path = "./common" }
supermusr-streaming-types = { path = "./streaming-types" }
taos = { version = "0.10.16", default_features = false, features = ["ws"] }
tokio = { version = "1.33", features = ["macros", "rt-multi-thread"] }
2 changes: 1 addition & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "common"
name = "supermusr-common"
version.workspace = true
license.workspace = true
edition.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions docs/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ In cases where the formatter does not care, the following rules apply:
```rust
use crate::Something;
use super::SomethingElse
use common::Time
use std::time::Duration
use supermusr_common::Time
use tokio::task::JoinHandle;
```

Expand All @@ -27,7 +27,7 @@ instead of
use crate::Something;

use tokio::task::JoinHandle;
use common::Time
use supermusr_common::Time

use std::time::Duration
use super::SomethingElse
Expand Down
5 changes: 2 additions & 3 deletions events-to-histogram/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ license.workspace = true
edition.workspace = true

[dependencies]
common = { path = "../common" }
streaming-types = { path = "../streaming-types" }

anyhow.workspace = true
clap.workspace = true
env_logger.workspace = true
Expand All @@ -17,6 +14,8 @@ log.workspace = true
ndarray.workspace = true
ndarray-stats.workspace = true
rdkafka.workspace = true
supermusr-common.workspace = true
supermusr-streaming-types.workspace = true
tokio.workspace = true

[dev-dependencies]
Expand Down
11 changes: 7 additions & 4 deletions events-to-histogram/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ mod processing;

use anyhow::Result;
use clap::Parser;
use common::Time;
use kagiyama::{AlwaysReady, Watcher};
use rdkafka::{
consumer::{stream_consumer::StreamConsumer, CommitMode, Consumer},
message::Message,
producer::{FutureProducer, FutureRecord},
};
use std::{net::SocketAddr, time::Duration};
use streaming_types::dev1_digitizer_event_v1_generated::{
use supermusr_common::Time;
use supermusr_streaming_types::dev1_digitizer_event_v1_generated::{
digitizer_event_list_message_buffer_has_identifier, root_as_digitizer_event_list_message,
};

Expand Down Expand Up @@ -59,8 +59,11 @@ async fn main() -> Result<()> {
metrics::register(&watcher);
watcher.start_server(args.observability_address).await;

let mut client_config =
common::generate_kafka_client_config(&args.broker, &args.username, &args.password);
let mut client_config = supermusr_common::generate_kafka_client_config(
&args.broker,
&args.username,
&args.password,
);

let consumer: StreamConsumer = client_config
.set("group.id", &args.consumer_group)
Expand Down
8 changes: 4 additions & 4 deletions events-to-histogram/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
pub(crate) use common::metrics::{
failures::{FailureKind, FailureLabels},
messages_received::{MessageKind, MessagesReceivedLabels},
};
use kagiyama::{
prometheus::metrics::{counter::Counter, family::Family},
AlwaysReady, Watcher,
};
use lazy_static::lazy_static;
pub(crate) use supermusr_common::metrics::{
failures::{FailureKind, FailureLabels},
messages_received::{MessageKind, MessagesReceivedLabels},
};

pub(crate) fn register(watcher: &Watcher<AlwaysReady>) {
let mut registry = watcher.metrics_registry();
Expand Down
6 changes: 3 additions & 3 deletions events-to-histogram/src/processing.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use common::{Channel, Time};
use ndarray::array;
use ndarray_stats::histogram::{self, Bins, Edges, Grid};
use std::collections::HashMap;
use streaming_types::{
use supermusr_common::{Channel, Time};
use supermusr_streaming_types::{
dev1_digitizer_event_v1_generated::DigitizerEventListMessage,
flatbuffers::FlatBufferBuilder,
frame_metadata_v1_generated::{FrameMetadataV1, FrameMetadataV1Args},
Expand Down Expand Up @@ -107,7 +107,7 @@ pub(crate) fn process(
mod tests {
use super::*;
use chrono::Utc;
use streaming_types::{
use supermusr_streaming_types::{
dev1_digitizer_event_v1_generated::{
finish_digitizer_event_list_message_buffer, root_as_digitizer_event_list_message,
DigitizerEventListMessage, DigitizerEventListMessageArgs,
Expand Down
9 changes: 4 additions & 5 deletions kafka-daq-report/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ license.workspace = true
edition.workspace = true

[dependencies]
common = { path = "../common" }
streaming-types = { path = "../streaming-types" }

anyhow.workspace = true
chrono.workspace = true
clap.workspace = true
crossterm = "0.26.1"
crossterm.workspace = true
env_logger.workspace = true
log.workspace = true
ratatui = "0.22.0"
ratatui.workspace = true
rdkafka.workspace = true
supermusr-common.workspace = true
supermusr-streaming-types.workspace = true
tokio.workspace = true
19 changes: 11 additions & 8 deletions kafka-daq-report/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::{
thread,
time::{Duration, Instant},
};
use streaming_types::dat1_digitizer_analog_trace_v1_generated::{
use supermusr_streaming_types::dat1_digitizer_analog_trace_v1_generated::{
digitizer_analog_trace_message_buffer_has_identifier, root_as_digitizer_analog_trace_message,
};
use tokio::task;
Expand Down Expand Up @@ -97,13 +97,16 @@ async fn main() -> Result<()> {
let args = Cli::parse();
log::debug!("Args: {:?}", args);

let consumer: StreamConsumer =
common::generate_kafka_client_config(&args.broker, &args.username, &args.password)
.set("group.id", &args.consumer_group)
.set("enable.partition.eof", "false")
.set("session.timeout.ms", "6000")
.set("enable.auto.commit", "false")
.create()?;
let consumer: StreamConsumer = supermusr_common::generate_kafka_client_config(
&args.broker,
&args.username,
&args.password,
)
.set("group.id", &args.consumer_group)
.set("enable.partition.eof", "false")
.set("session.timeout.ms", "6000")
.set("enable.auto.commit", "false")
.create()?;

consumer.subscribe(&[&args.trace_topic])?;

Expand Down
7 changes: 3 additions & 4 deletions simulator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ license.workspace = true
edition.workspace = true

[dependencies]
common = { path = "../common" }
streaming-types = { path = "../streaming-types" }

clap.workspace = true
chrono.workspace = true
clap.workspace = true
env_logger.workspace = true
log.workspace = true
rdkafka.workspace = true
supermusr-common.workspace = true
supermusr-streaming-types.workspace = true
tokio.workspace = true
Loading

0 comments on commit 68560d8

Please sign in to comment.