Skip to content

Commit

Permalink
Bump toolchain to 2020-08-08 (dev/graph) (#910)
Browse files Browse the repository at this point in the history
* Pin `error-stack` revision to 5edddb5 in hEngine (#908)
* Bump Rust toolchain to `2022-08-08` (#904)
* Use `error-stack` by path (#901)
* Fix output of toolchain in CI (#902)
* Apply changes to `hash_graph`
* Fix clippy for apple
* Disable `miri` for `error-stack`
  • Loading branch information
TimDiekmann authored Aug 9, 2022
1 parent 07bed43 commit 7d0c27b
Show file tree
Hide file tree
Showing 48 changed files with 175 additions and 147 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: |
nightly=$(cat $(find . -name rust-toolchain.toml) | grep channel | cut -d\" -f2)
echo "::set-output name=nightly::$nightly"
echo "use toolchains: $(echo $nightly | jq -r)"
echo "use toolchains: $(echo $nightly)"
- name: Determine samples
id: samples
Expand Down
6 changes: 4 additions & 2 deletions packages/engine/Cargo.lock

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

3 changes: 2 additions & 1 deletion packages/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ experiment-structure = { path = "lib/experiment-structure", default-features = f
experiment-control = { path = "lib/experiment-control", default-features = false }
orchestrator = { path = "lib/orchestrator", default-features = false }

error-stack = { version = "0.1.1", features = ["spantrace"] }
# TODO: Change to `version = "0.2"` as soon as it's released
error-stack = { git = "https://github.com/hashintel/hash", rev = "5edddb5", features = ["spantrace"] }

num_cpus = "1.13.0"
serde = { version = "1.0.111", features = ["derive"] }
Expand Down
3 changes: 2 additions & 1 deletion packages/engine/bin/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ experiment-structure = { path = "../../lib/experiment-structure", default-featur
experiment-control = { path = "../../lib/experiment-control", default-features = false, features = ["clap"] }
orchestrator = { path = "../../lib/orchestrator", default-features = false, features = ["clap"] }

error-stack = { version = "0.1.1", features = ["spantrace"] }
# TODO: Change to `version = "0.2"` as soon as it's released
error-stack = { git = "https://github.com/hashintel/hash", rev = "5edddb5", features = ["spantrace"] }

clap = { version = "3.0.0", features = ["cargo", "derive", "env"] }
serde = { version = "1.0.111", features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions packages/engine/bin/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async fn main() -> Result<(), CliError> {
&format!("cli-{now}"),
&format!("cli-{now}-texray"),
)
.report()
.into_report()
.attach_printable("Failed to initialize the logger")
.change_context(CliError)?;

Expand All @@ -71,7 +71,7 @@ async fn main() -> Result<(), CliError> {
let absolute_project_path = args
.project
.canonicalize()
.report()
.into_report()
.attach_printable_lazy(|| {
format!("Could not canonicalize project path: {:?}", args.project)
})
Expand Down
3 changes: 2 additions & 1 deletion packages/engine/bin/hash_engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ execution = { path = "../../lib/execution", default-features = false }
experiment-structure = { path = "../../lib/experiment-structure", default-features = false }
experiment-control = { path = "../../lib/experiment-control", default-features = false, features = ["clap"] }

error-stack = { version = "0.1.1", features = ["spantrace"] }
# TODO: Change to `version = "0.2"` as soon as it's released
error-stack = { git = "https://github.com/hashintel/hash", rev = "5edddb5", features = ["spantrace"] }

tokio = "1.18.2"
tracing = "0.1.29"
Expand Down
6 changes: 3 additions & 3 deletions packages/engine/bin/hash_engine/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ async fn main() -> Result<(), EngineError> {
&format!("experiment-{}", args.experiment_id),
&format!("experiment-{}-texray", args.experiment_id),
)
.report()
.into_report()
.attach_printable("Failed to initialize the logger")
.change_context(EngineError)?;

let mut env = Environment::new(&args)
.await
.report()
.into_report()
.attach_printable("Could not create environment for experiment")
.change_context(EngineError)?;
// Fetch all dependencies of the experiment run such as datasets
Expand All @@ -70,7 +70,7 @@ async fn main() -> Result<(), EngineError> {

let experiment_result = run_experiment(config, env)
.await
.report()
.into_report()
.attach_printable("Could not run experiment")
.change_context(EngineError);

Expand Down
3 changes: 2 additions & 1 deletion packages/engine/lib/experiment-control/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ execution = { path = "../execution", default-features = false }
experiment-structure = { path = "../experiment-structure", default-features = false }
simulation-control = { path = "../simulation-control", default-features = false }

error-stack = { version = "0.1.1", features = ["spantrace"] }
# TODO: Change to `version = "0.2"` as soon as it's released
error-stack = { git = "https://github.com/hashintel/hash", rev = "5edddb5", features = ["spantrace"] }

clap = { version = "3.0.0", features = ["cargo", "derive", "env"], optional = true }
num_cpus = "1.13.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/engine/lib/experiment-structure/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ edition = "2021"
stateful = { path = "../stateful", default-features = false }
execution = { path = "../execution", default-features = false }

error-stack = "0.1.1"
# TODO: Change to `version = "0.2"` as soon as it's released
error-stack = { git = "https://github.com/hashintel/hash", rev = "5edddb5", features = ["spantrace"] }

async-trait = "0.1.48"
csv = "1.1.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl ExperimentConfig {
})
.build()?;
let base_globals: Globals = serde_json::from_str(&simulation.globals_src)
.report()
.into_report()
.attach_printable("Could not parse globals JSON")
.change_context(ConfigError)?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl PackageConfigBuilder {
{
let deps = dependency
.get_all_dependencies()
.report()
.into_report()
.attach_printable_lazy(|| format!("Could not get dependencies for {dependency}"))
.change_context(ConfigError)?;
for dep in deps.into_iter_deps() {
Expand Down
28 changes: 14 additions & 14 deletions packages/engine/lib/experiment-structure/src/experiment/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn get_simple_experiment_config(
.ok_or_else(|| Report::new(ExperimentPlanError))
.attach_printable("Experiment configuration not found: experiments.json")?;
let parsed = serde_json::from_str(experiments_manifest)
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Could not parse experiment manifest")?;
let plan = create_experiment_plan(&parsed, &experiment_name)
Expand Down Expand Up @@ -131,7 +131,7 @@ fn create_multiparameter_variant(
}

let var: MultiparameterVariant = serde_json::from_value(selected_experiment.clone())
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Could not parse multiparameter variant")?;
let subplans = var
Expand Down Expand Up @@ -188,7 +188,7 @@ fn create_group_variant(
runs: Vec<ExperimentName>,
}
let var: GroupVariant = serde_json::from_value(selected_experiment.clone())
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Could not create group variant")?;
var.runs.iter().try_fold(
Expand Down Expand Up @@ -287,37 +287,37 @@ fn create_monte_carlo_variant_plan(
let distribution = match self.distribution.as_str() {
"normal" => Box::new(
Normal::new(self.mean.unwrap_or(1.0), self.std.unwrap_or(1.0))
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Unable to create normal distribution")?,
) as Box<dyn DynDistribution<f64>>,
"log-normal" => Box::new(
LogNormal::new(self.mu.unwrap_or(1.0), self.sigma.unwrap_or(1.0))
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Unable to create log-normal distribution")?,
),
"poisson" => Box::new(
Poisson::new(self.rate.unwrap_or(1.0))
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Unable to create poisson distribution")?,
),
"beta" => Box::new(
Beta::new(self.alpha.unwrap_or(1.0), self.beta.unwrap_or(1.0))
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Unable to create beta distribution")?,
),
"gamma" => Box::new(
Gamma::new(self.shape.unwrap_or(1.0), self.scale.unwrap_or(1.0))
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Unable to create gamma distribution")?,
),
_ => Box::new(
Normal::new(1.0, 1.0)
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Unable to create normal distribution")?,
),
Expand All @@ -330,7 +330,7 @@ fn create_monte_carlo_variant_plan(
}

let var: MonteCarloVariant = serde_json::from_value(selected_experiment.clone())
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Could not create monte carlo distribution")?;
let values: Vec<_> = (0..var.samples as usize).map(|_| 0.into()).collect();
Expand All @@ -355,7 +355,7 @@ fn create_value_variant_plan(
}

let var: ValueVariant = serde_json::from_value(selected_experiment.clone())
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Could not parse value variant")?;
let mapper: Mapper = Box::new(|val, _index| val);
Expand All @@ -381,7 +381,7 @@ fn create_linspace_variant_plan(
stop: f64,
}
let var: LinspaceVariant = serde_json::from_value(selected_experiment.clone())
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Could not create linspace variant")?;
let values: Vec<_> = (0..var.samples as usize).map(|_| 0.into()).collect();
Expand Down Expand Up @@ -420,7 +420,7 @@ fn create_arange_variant_plan(
stop: f64,
}
let var: ArangeVariant = serde_json::from_value(selected_experiment.clone())
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Could not create arange variant")?;
let mut values = vec![];
Expand Down Expand Up @@ -453,7 +453,7 @@ fn create_meshgrid_variant_plan(
y: [f64; 3], // [start, stop, num_samples]
}
let var: MeshgridVariant = serde_json::from_value(selected_experiment.clone())
.report()
.into_report()
.change_context(ExperimentPlanError)
.attach_printable("Could not create meshgrid variant")?;

Expand Down
14 changes: 7 additions & 7 deletions packages/engine/lib/experiment-structure/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ impl Manifest {
tracing::debug!("Reading behaviors in {src_folder:?}");
for entry in src_folder
.read_dir()
.report()
.into_report()
.attach_printable_lazy(|| format!("Could not read behavior directory: {src_folder:?}"))
.change_context(ManifestError)?
{
Expand Down Expand Up @@ -387,7 +387,7 @@ impl Manifest {
tracing::debug!("Reading datasets in {src_folder:?}");
for entry in src_folder
.read_dir()
.report()
.into_report()
.attach_printable_lazy(|| format!("Could not read dataset directory: {src_folder:?}"))
.change_context(ManifestError)?
{
Expand Down Expand Up @@ -713,7 +713,7 @@ fn _try_read_local_dependencies<P: AsRef<Path>>(dependency_path: P) -> Result<Ve

let mut entries = dependency_path
.read_dir()
.report()
.into_report()
.attach_printable_lazy(|| format!("Could not read dependency directory: {dependency_path:?}"))
.change_context(ManifestError)?
.filter_map(|dir_res| {
Expand All @@ -729,7 +729,7 @@ fn _try_read_local_dependencies<P: AsRef<Path>>(dependency_path: P) -> Result<Ve
user_dir
.path()
.read_dir()
.report()
.into_report()
.attach_printable_lazy(|| {
format!("Could not read directory {:?}", user_dir.path())
})
Expand Down Expand Up @@ -770,7 +770,7 @@ fn file_contents<P: AsRef<Path>>(path: P) -> Result<String> {
let path = path.as_ref();
tracing::debug!("Reading contents at path: {path:?}");
std::fs::read_to_string(path)
.report()
.into_report()
.attach_printable_lazy(|| format!("Could not read file: {path:?}"))
.change_context(ManifestError)
}
Expand All @@ -788,11 +788,11 @@ fn parse_file<T: DeserializeOwned, P: AsRef<Path>>(path: P) -> Result<T> {
let path = path.as_ref();
serde_json::from_reader(BufReader::new(
File::open(path)
.report()
.into_report()
.attach_printable_lazy(|| format!("Could not read file {path:?}"))
.change_context(ManifestError)?,
))
.report()
.into_report()
.attach_printable_lazy(|| format!("Could not parse {path:?}"))
.change_context(ManifestError)
}
2 changes: 1 addition & 1 deletion packages/engine/lib/memory/src/arrow/ffi/flush.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ unsafe extern "C" fn flush_changes(
let changes = &*changes;
// Use this base lifetime for everything
let static_meta_ref = &*static_meta;
let num_changes = (*changes).len;
let num_changes = changes.len;
let indices = std::slice::from_raw_parts(changes.indices, num_changes);
let arrays = std::slice::from_raw_parts(changes.columns, num_changes);
let prepared_columns: Vec<PreparedColumn<'_>> = match (0..num_changes)
Expand Down
4 changes: 2 additions & 2 deletions packages/engine/lib/memory/src/arrow/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ unsafe extern "C" fn get_static_metadata(schema: usize) -> *const meta::Static {
#[no_mangle]
unsafe extern "C" fn free_static_metadata(ptr: *mut meta::Static) {
if !ptr.is_null() {
Box::from_raw(ptr);
drop(Box::from_raw(ptr));
}
}

Expand Down Expand Up @@ -136,6 +136,6 @@ unsafe extern "C" fn get_dynamic_metadata(memory_ptr: *const CSegment) -> *const
#[no_mangle]
unsafe extern "C" fn free_dynamic_metadata(ptr: *mut meta::Dynamic) {
if !ptr.is_null() {
Box::from_raw(ptr);
drop(Box::from_raw(ptr));
}
}
2 changes: 1 addition & 1 deletion packages/engine/lib/memory/src/shared_memory/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ unsafe extern "C" fn load_shmem(id: *const u8, len: u64) -> *mut CSegment {
#[no_mangle]
// Free memory and drop Memory object
unsafe extern "C" fn free_memory(c_memory: *mut CSegment) {
Box::from_raw((*c_memory).segment as *mut Segment);
drop(Box::from_raw((*c_memory).segment as *mut Segment));
}

const _: () = assert!(
Expand Down
7 changes: 5 additions & 2 deletions packages/engine/lib/memory/src/shared_memory/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

use std::ops::{Index, IndexMut};

#[cfg(not(target_vendor = "apple"))]
use crate::{error::Error, shared_memory::markers::Val};
use crate::{
error::{Error, Result},
error::Result,
shared_memory::{
continuation::{arrow_continuation, buffer_without_continuation, CONTINUATION},
markers::{Buffer, Markers, Val},
markers::{Buffer, Markers},
ptr::MemoryPtr,
BufferChange, Segment,
},
Expand Down Expand Up @@ -174,6 +176,7 @@ impl<'mem: 'v, 'v> VisitorMut<'mem> {
self.prepare_buffer_write(&Buffer::Data, size)
}

#[cfg(not(target_vendor = "apple"))]
pub fn shrink_with_data_length(&mut self, size: usize) -> Result<BufferChange> {
let markers = self.markers_mut();
if size >= markers.data_size() {
Expand Down
3 changes: 2 additions & 1 deletion packages/engine/lib/nano/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ version = "0.0.0"
edition = "2021"

[dependencies]
error-stack = { version = "0.1.1", features = ["spantrace"] }
# TODO: Change to `version = "0.2"` as soon as it's released
error-stack = { git = "https://github.com/hashintel/hash", rev = "5edddb5", features = ["spantrace"] }

nng = { version = "1.0.1", default-features = false }
serde = { version = "1.0.111", features = ["derive"] }
Expand Down
Loading

0 comments on commit 7d0c27b

Please sign in to comment.