Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: implement ListScalars and ReadScalars #4386

Merged
merged 53 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
84d6175
rust: add `data_compat` module
wchargin Nov 17, 2020
1459d88
rust: use `thiserror` for error types
wchargin Nov 17, 2020
f52200f
rust: create `types` module with primitives like `Step`
wchargin Nov 18, 2020
5e16ea3
Merge remote-tracking branches 'origin/wchargin-rust-data-compat', 'o…
wchargin Nov 18, 2020
997ddfa
[update patch]
wchargin Nov 18, 2020
103ccbd
[update diffbase]
wchargin Nov 18, 2020
734d780
[update diffbase]
wchargin Nov 18, 2020
d7fddfa
rust: promote event values to `data_compat`
wchargin Nov 18, 2020
76bcca2
[update diffbase]
wchargin Nov 19, 2020
9ba9726
[update patch]
wchargin Nov 19, 2020
aef800e
[update diffbase]
wchargin Nov 19, 2020
dd3e955
rust: define shared `Commit` type
wchargin Nov 19, 2020
0e1a45b
rust: commit changes after run loading
wchargin Nov 19, 2020
532ea1a
[update patch]
wchargin Nov 19, 2020
c577558
[update diffbase]
wchargin Nov 19, 2020
8b11660
[update diffbase]
wchargin Nov 19, 2020
b8121ac
[update diffbase]
wchargin Nov 19, 2020
f5d7542
[update patch]
wchargin Nov 19, 2020
e7a6f6b
[update diffbase]
wchargin Nov 19, 2020
b41f47f
[update patch]
wchargin Nov 19, 2020
3c7e13c
[update diffbase]
wchargin Nov 19, 2020
587e1af
[update diffbase]
wchargin Nov 19, 2020
ec0cf2c
[update diffbase]
wchargin Nov 19, 2020
d9f9f19
[update diffbase]
wchargin Nov 19, 2020
d39710a
[update patch]
wchargin Nov 19, 2020
5025feb
[update diffbase]
wchargin Nov 21, 2020
6480fdf
[update patch]
wchargin Nov 21, 2020
d1aa9a4
[update diffbase]
wchargin Nov 23, 2020
4c28c91
[update patch]
wchargin Nov 23, 2020
d2b3bf4
[update diffbase]
wchargin Nov 23, 2020
d5f2ae0
[update patch]
wchargin Nov 23, 2020
140aae1
rust: discover event files in log directories
wchargin Nov 24, 2020
f7a7cc0
rust: reload data in log directories
wchargin Nov 24, 2020
6a38bb6
[update diffbase]
wchargin Nov 24, 2020
5bedfd8
[update patch]
wchargin Nov 24, 2020
293f887
[update diffbase]
wchargin Nov 24, 2020
ed39120
rust: implement `ListRuns` RPC
wchargin Nov 24, 2020
641411b
rust: implement `ListScalars` and `ReadScalars`
wchargin Nov 24, 2020
cf7d310
[update patch]
wchargin Nov 24, 2020
d96e53d
[update diffbase]
wchargin Nov 24, 2020
1c625f0
[update diffbase]
wchargin Nov 24, 2020
3184115
[update diffbase]
wchargin Nov 24, 2020
46ac8fd
[update diffbase]
wchargin Nov 24, 2020
34ce4d2
[update patch]
wchargin Nov 24, 2020
8e58aca
[update diffbase]
wchargin Nov 24, 2020
7b331f0
[update diffbase]
wchargin Nov 24, 2020
758ae4d
[update diffbase]
wchargin Nov 24, 2020
04982ae
[update diffbase]
wchargin Nov 24, 2020
17eeeb7
[update diffbase]
wchargin Nov 25, 2020
3c4742d
[update diffbase]
wchargin Nov 25, 2020
ac16bd5
[update diffbase]
wchargin Nov 25, 2020
24e3b6b
[update patch]
wchargin Nov 25, 2020
e1751ed
[update patch]
wchargin Nov 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion tensorboard/data/server/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,44 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

use std::path::PathBuf;
use std::time::{Duration, Instant};
use tonic::transport::Server;

use rustboard_core::commit::Commit;
use rustboard_core::logdir::LogdirLoader;
use rustboard_core::proto::tensorboard::data::tensor_board_data_provider_server::TensorBoardDataProviderServer;
use rustboard_core::server::DataProviderHandler;

const RELOAD_INTERVAL: Duration = Duration::from_secs(5);

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let addr = "[::0]:6806".parse::<std::net::SocketAddr>()?;
let handler = DataProviderHandler;
let logdir = match std::env::args_os().nth(1) {
Some(d) => PathBuf::from(d),
None => {
eprintln!("fatal: specify logdir as first command-line argument");
std::process::exit(1);
}
};

// Leak the commit object, since the Tonic server must have only 'static references. This only
// leaks the outer commit structure (of constant size), not the pointers to the actual data.
let commit: &'static Commit = Box::leak(Box::new(Commit::new()));
std::thread::spawn(move || {
let mut loader = LogdirLoader::new(commit, logdir);
loop {
eprintln!("beginning load cycle");
let start = Instant::now();
loader.reload();
let end = Instant::now();
eprintln!("finished load cycle ({:?})", end - start);
std::thread::sleep(RELOAD_INTERVAL);
}
});

let handler = DataProviderHandler { commit };
Server::builder()
.add_service(TensorBoardDataProviderServer::new(handler))
.serve(addr)
Expand Down
3 changes: 2 additions & 1 deletion tensorboard/data/server/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ impl RunLoader {
}

fn commit_all(&mut self, run_data: &RwLock<commit::RunData>) {
let mut run = run_data.write().expect("acquiring run data lock");
let mut run = run_data.write().expect("acquiring tags lock");
run.start_time = self.start_time;
for (tag, ts) in &mut self.time_series {
ts.commit(tag, &mut *run);
}
Expand Down
Loading