Skip to content

Commit

Permalink
Move tooling to deib-polimi/noir-extra
Browse files Browse the repository at this point in the history
  • Loading branch information
imDema committed Jan 20, 2023
1 parent 7c7e1e5 commit 5b25624
Show file tree
Hide file tree
Showing 27 changed files with 12 additions and 3,238 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --tests --all -- -D warnings
args: --all-targets --all -- -D warnings

test:
name: Test
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ fn main() {
let (config, args) = EnvironmentConfig::from_args();
let mut env = StreamEnvironment::new(config);
env.spawn_remote_workers();
let source = FileSource::new(&args[0]);
// Create file source

let result = env
.stream(source)
// Open and read file line by line in parallel
.stream_file(&args[0])
// Split into words
.flat_map(|line| tokenize(&line))
// Partition
Expand All @@ -32,10 +32,11 @@ fn main() {
.fold(0, |count, _word| *count += 1)
// Collect result
.collect_vec();

env.execute(); // Start execution (blocking)
if let Some(result) = result.get() {
// Print word counts
println!("{:?}", result);
result.into_iter().for_each(|(word, count)| println!("{word}: {count}"));
}
}

Expand All @@ -45,4 +46,6 @@ fn tokenize(s: &str) -> Vec<String> {
}

// Execute on 6 local hosts `cargo run -- -l 6 input.txt`
```
```

# Documentation is WIP
2 changes: 1 addition & 1 deletion examples/rolling_top_words.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fn main() {
env.spawn_remote_workers();

let source = ParallelIteratorSource::new(|id, num_replicas| {
TopicSource::new(id as u64, num_replicas as u64)
TopicSource::new(id, num_replicas)
});
env.stream(source)
// add a timestamp for each item (using the one generated by the source) and add a watermark
Expand Down
2 changes: 1 addition & 1 deletion examples/rolling_top_words_e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn main() {
env.spawn_remote_workers();

let source = ParallelIteratorSource::new(move |id, num_replicas| {
TopicSource::new(id as u64, num_replicas as u64, limit)
TopicSource::new(id, num_replicas, limit)
});
env.stream(source)
// add a timestamp for each item (using the one generated by the source) and add a watermark
Expand Down
3 changes: 1 addition & 2 deletions src/operator/source/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::fs::File;
use std::io::BufRead;
use std::io::Seek;
use std::io::{BufReader, SeekFrom};
use std::path::Path;
use std::path::PathBuf;

use crate::block::{BlockStructure, OperatorKind, OperatorStructure};
Expand Down Expand Up @@ -169,7 +168,7 @@ impl Clone for FileSource {

impl crate::StreamEnvironment {
/// Convenience method, creates a `FileSource` and makes a stream using `StreamEnvironment::stream`
pub fn stream_file(&mut self, path: &Path) -> Stream<String, FileSource> {
pub fn stream_file<P: Into<PathBuf>>(&mut self, path: P) -> Stream<String, FileSource> {
let source = FileSource::new(path);
self.stream(source)
}
Expand Down
5 changes: 0 additions & 5 deletions tools/benchmarks/.gitignore

This file was deleted.

101 changes: 0 additions & 101 deletions tools/benchmarks/README.md

This file was deleted.

183 changes: 0 additions & 183 deletions tools/benchmarks/aggregate_csv.py

This file was deleted.

Loading

0 comments on commit 5b25624

Please sign in to comment.