After rustfmt

This commit is contained in:
Dominik Werder
2021-04-16 14:43:21 +02:00
parent 1150bb3c55
commit 3afcddb1c7
16 changed files with 951 additions and 832 deletions

View File

@@ -1,8 +1,8 @@
#[allow(unused_imports)]
use tracing::{error, warn, info, debug, trace};
use err::Error;
use netpod::{ChannelConfig, Channel, timeunits::*, ScalarType, Shape, Node, Cluster, NodeConfig};
use netpod::{timeunits::*, Channel, ChannelConfig, Cluster, Node, NodeConfig, ScalarType, Shape};
use std::sync::Arc;
#[allow(unused_imports)]
use tracing::{debug, error, info, trace, warn};
pub fn main() {
match taskrun::run(go()) {
@@ -60,9 +60,7 @@ fn simple_fetch() {
tb_file_count: 1,
buffer_size: 1024 * 8,
};
let cluster = Cluster {
nodes: vec![node],
};
let cluster = Cluster { nodes: vec![node] };
let cluster = Arc::new(cluster);
let node_config = NodeConfig {
cluster: cluster,
@@ -99,8 +97,13 @@ fn simple_fetch() {
let t2 = chrono::Utc::now();
let ms = t2.signed_duration_since(t1).num_milliseconds() as u64;
let throughput = ntot / 1024 * 1000 / ms;
info!("total download {} MB throughput {:5} kB/s", ntot / 1024 / 1024, throughput);
info!(
"total download {} MB throughput {:5} kB/s",
ntot / 1024 / 1024,
throughput
);
//Err::<(), _>(format!("test error").into())
Ok(())
}).unwrap();
})
.unwrap();
}

View File

@@ -1,4 +1,4 @@
use clap::{Clap, crate_version};
use clap::{crate_version, Clap};
#[derive(Debug, Clap)]
#[clap(name="retrieval", author="Dominik Werder <dominik.werder@gmail.com>", version=crate_version!())]
@@ -15,5 +15,4 @@ pub enum SubCmd {
}
#[derive(Debug, Clap)]
pub struct Retrieval {
}
pub struct Retrieval {}

View File

@@ -1,10 +1,10 @@
#[allow(unused_imports)]
use tracing::{error, warn, info, debug, trace};
use err::Error;
use tokio::task::JoinHandle;
use netpod::{Node, Cluster, NodeConfig};
use hyper::Body;
use netpod::{Cluster, Node, NodeConfig};
use std::sync::Arc;
use tokio::task::JoinHandle;
#[allow(unused_imports)]
use tracing::{debug, error, info, trace, warn};
pub mod cli;
@@ -47,28 +47,31 @@ async fn get_cached_0_inner() -> Result<(), Error> {
let t2 = chrono::Utc::now();
let ms = t2.signed_duration_since(t1).num_milliseconds() as u64;
let throughput = ntot / 1024 * 1000 / ms;
info!("get_cached_0 DONE total download {} MB throughput {:5} kB/s", ntot / 1024 / 1024, throughput);
info!(
"get_cached_0 DONE total download {} MB throughput {:5} kB/s",
ntot / 1024 / 1024,
throughput
);
//Err::<(), _>(format!("test error").into())
Ok(())
}
fn test_cluster() -> Cluster {
let nodes = (0..1).into_iter().map(|id| {
let node = Node {
id,
host: "localhost".into(),
port: 8360 + id as u16,
data_base_path: format!("../tmpdata/node{:02}", id).into(),
ksprefix: "ks".into(),
split: 0,
};
Arc::new(node)
})
.collect();
Cluster {
nodes: nodes,
}
let nodes = (0..1)
.into_iter()
.map(|id| {
let node = Node {
id,
host: "localhost".into(),
port: 8360 + id as u16,
data_base_path: format!("../tmpdata/node{:02}", id).into(),
ksprefix: "ks".into(),
split: 0,
};
Arc::new(node)
})
.collect();
Cluster { nodes: nodes }
}
fn spawn_test_hosts(cluster: Arc<Cluster>) -> Vec<JoinHandle<Result<(), Error>>> {