Skip to content

Commit

Permalink
Upgrade Jupyter
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiimk committed Jul 13, 2021
1 parent 30f948b commit 387d7a0
Show file tree
Hide file tree
Showing 17 changed files with 117 additions and 23 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.47.0] - 2021-07-12
### Fixed
- Upgrading to newer Jupyter and Sparkmagic (fixes some issues in notebooks)
- Better error handling
### Added
- Environment variable completions

## [0.46.0] - 2021-07-11
### Changed
- Multiple internal improvements
Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

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

67 changes: 67 additions & 0 deletions examples/currency_conversion/rates.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%load_ext kamu"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%import_dataset ca.bankofcanada.exchange-rates.daily --alias rates"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"rates.printSchema()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"select * from rates"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "PySpark",
"language": "python",
"name": "pysparkkernel"
},
"language_info": {
"codemirror_mode": {
"name": "python",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "pyspark",
"pygments_lexer": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
11 changes: 7 additions & 4 deletions examples/housing_prices/heatmap.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"%%local\n",
Expand Down Expand Up @@ -179,17 +181,18 @@
"metadata": {
"kernelspec": {
"display_name": "PySpark",
"language": "",
"language": "python",
"name": "pysparkkernel"
},
"language_info": {
"codemirror_mode": {
"name": "python",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "pyspark",
"pygments_lexer": "python2"
"pygments_lexer": "python3"
}
},
"nbformat": 4,
Expand Down
7 changes: 4 additions & 3 deletions examples/housing_prices/spatial_join.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,18 @@
"metadata": {
"kernelspec": {
"display_name": "PySpark",
"language": "",
"language": "python",
"name": "pysparkkernel"
},
"language_info": {
"codemirror_mode": {
"name": "python",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "pyspark",
"pygments_lexer": "python2"
"pygments_lexer": "python3"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion kamu-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kamu-cli"
version = "0.46.0"
version = "0.47.0"
description = "Decentralized data management tool"
authors = ["Sergii Mikhtoniuk <mikhtoniuk@gmail.com>"]
license = "MPL-2.0"
Expand Down
4 changes: 2 additions & 2 deletions kamu-cli/src/cli_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,10 @@ pub fn cli(binary_name: &'static str, version: &'static str) -> App<'static, 'st
.args(&[
Arg::with_name("pull-images")
.long("pull-images")
.help("Only pull docker images and exit"),
.help("Only pull container images and exit"),
Arg::with_name("pull-test-images")
.long("pull-test-images")
.help("Only pull test-related docker images and exit")
.help("Only pull test-related container images and exit")
.hidden(true),
])
.after_help(indoc::indoc!(
Expand Down
9 changes: 9 additions & 0 deletions kamu-cli/src/commands/complete_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ impl CompleteCommand {
println!("{}", Utc::now().to_rfc3339_opts(SecondsFormat::Secs, true));
}

fn complete_env_var(&self, prefix: &str) {
for (k, _) in std::env::vars() {
if k.starts_with(prefix) {
println!("{}", k);
}
}
}

fn complete_dataset(&self, prefix: &str) {
if let Some(repo) = self.metadata_repo.as_ref() {
for dataset_id in repo.get_all_datasets() {
Expand Down Expand Up @@ -144,6 +152,7 @@ impl Command for CompleteCommand {
match *name {
"REMOTE" => self.complete_remote(to_complete),
"TIME" => self.complete_timestamp(),
"VAR" => self.complete_env_var(&to_complete),
_ => (),
}
}
Expand Down
2 changes: 1 addition & 1 deletion kamu-cli/src/commands/notebook_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl PullImageListener for PullImageProgress {
fn begin(&mut self, image: &str) {
let s = indicatif::ProgressBar::new_spinner();
s.set_style(indicatif::ProgressStyle::default_spinner().template("{spinner:.cyan} {msg}"));
s.set_message(format!("Pulling docker image {}", image));
s.set_message(format!("Pulling container image {}", image));
s.enable_steady_tick(100);
self.progress_bar = Some(s);
}
Expand Down
2 changes: 1 addition & 1 deletion kamu-cli/src/commands/sql_shell_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl PullImageListener for PullImageProgress {
fn begin(&mut self, image: &str) {
let s = indicatif::ProgressBar::new_spinner();
s.set_style(indicatif::ProgressStyle::default_spinner().template("{spinner:.cyan} {msg}"));
s.set_message(format!("Pulling docker image {}", image));
s.set_message(format!("Pulling contaner image {}", image));
s.enable_steady_tick(100);
self.progress_bar = Some(s);
}
Expand Down
2 changes: 1 addition & 1 deletion kamu-core-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kamu-test"
version = "0.46.0"
version = "0.47.0"
authors = ["Sergii Mikhtoniuk <mikhtoniuk@gmail.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion kamu-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kamu"
version = "0.46.0"
version = "0.47.0"
authors = ["Sergii Mikhtoniuk <mikhtoniuk@gmail.com>"]
edition = "2018"

Expand Down
4 changes: 4 additions & 0 deletions kamu-core/src/infra/explore/notebook_server_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ impl NotebookServerImpl {
image: docker_images::JUPYTER.to_owned(),
container_name: Some("kamu-jupyter".to_owned()),
network: Some(network_name.to_owned()),
user: Some("root".to_owned()),
work_dir: Some(PathBuf::from("/opt/workdir")),
expose_ports: vec![80],
volume_map: vec![(cwd.clone(), PathBuf::from("/opt/workdir"))],
environment_vars: environment_vars,
Expand Down Expand Up @@ -143,6 +145,7 @@ impl NotebookServerImpl {
signal_hook::flag::register(libc::SIGINT, exit.clone())?;
signal_hook::flag::register(libc::SIGTERM, exit.clone())?;

// TODO: Detect crashed processes
// Relying on shell to send signal to child processes
while !exit.load(Ordering::Relaxed) {
std::thread::sleep(std::time::Duration::from_millis(100));
Expand All @@ -162,6 +165,7 @@ impl NotebookServerImpl {
.run_shell_cmd(
DockerRunArgs {
image: docker_images::JUPYTER.to_owned(),
user: Some("root".to_owned()),
container_name: Some("kamu-jupyter".to_owned()),
volume_map: vec![(cwd, PathBuf::from("/opt/workdir"))],
..DockerRunArgs::default()
Expand Down
4 changes: 3 additions & 1 deletion kamu-core/src/infra/utils/docker_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl DockerClient {
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()
.expect("Docker process failed")
.expect("Process failed")
.success()
}

Expand All @@ -155,6 +155,8 @@ impl DockerClient {
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()
.expect("Failed to start pull process")
.exit_ok()
.expect("Failed to pull image");

listener.success();
Expand Down
2 changes: 1 addition & 1 deletion kamu-core/src/infra/utils/docker_images.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub const SPARK: &str = "docker.io/kamudata/engine-spark:0.10.3";
pub const LIVY: &str = SPARK;
pub const FLINK: &str = "docker.io/kamudata/engine-flink:0.8.0-flink_1.13.1-scala_2.12-java8";
pub const JUPYTER: &str = "docker.io/kamudata/jupyter-uber:0.0.1";
pub const JUPYTER: &str = "docker.io/kamudata/jupyter:0.1.0";

// Test Images
pub const HTTPD: &str = "docker.io/httpd:2.4";
Expand Down
1 change: 1 addition & 0 deletions kamu-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![feature(backtrace)]
#![feature(with_options)]
#![feature(map_first_last)]
#![feature(exit_status_error)]

pub mod domain;
pub mod infra;
2 changes: 1 addition & 1 deletion opendatafabric/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "opendatafabric"
version = "0.46.0"
version = "0.47.0"
authors = ["Sergii Mikhtoniuk <mikhtoniuk@gmail.com>"]
edition = "2018"

Expand Down

0 comments on commit 387d7a0

Please sign in to comment.