Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
},
"runArgs": [
"--name=${localWorkspaceFolderBasename}_devcontainer",
"--cpus=2",
"--memory=8gb",
"--privileged",
"--cgroupns=host"
],
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/gpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN \
RUN \
# dev setup
apt update && \
apt-get install build-essential sudo jq git bash-completion rsync -y && \
apt-get install build-essential sudo jq git bash-completion graphviz rsync -y && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
echo '. /etc/bash_completion' >> /root/.bashrc && \
echo 'export PS1="\[\e[32;1m\]\u\[\e[m\]@\[\e[34;1m\]\H\[\e[m\]:\[\e[33;1m\]\w\[\e[m\]$ "' >> /root/.bashrc && \
Expand All @@ -31,6 +31,8 @@ RUN apt-get update && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs
# rust code coverage
cargo install cargo-llvm-cov && \
rustup component add llvm-tools-preview && \
# rust crate structure diagram
cargo install cargo-modules && \
apt-get clean

ENV PATH=${PATH}:/root/.local/bin
Expand Down
2 changes: 0 additions & 2 deletions .devcontainer/gpu/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
},
"runArgs": [
"--name=${localWorkspaceFolderBasename}_devcontainer",
"--cpus=2",
"--memory=8gb",
"--gpus=all",
"--privileged",
"--cgroupns=host"
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ jobs:
cargo modules dependencies \
--no-uses --no-fns \
--focus-on "orcapod::model::{Pod}" \
--layout dot | dot -T svg > docs/crate_diagram.svg
--layout dot | \
awk '/ERROR/ { print > "/dev/stderr"; next; }; 1' | \
dot -T svg > docs/crate_diagram.svg
- name: Sync GitHub
run: |
git config user.name github-actions
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ categories = [

]
license = "MIT license"
edition = "2021"
edition = "2024"

[dependencies]
bollard = "0.17.1" # docker API in orchestrator
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,21 @@ We track only issues in the project so don't add PRs.
# based on debian
chmod u=rwx,g=rx,o=rx $(find . -not -path "./.git*" -type d | sort) # directories
chmod u=rw,g=r,o=r $(find . -not -path "./.git/*" -type f | sort) # files
```
```

## Limit DevContainer Resource Access

You can easily enforce resource limits by adding the following to `devcontainer.json`.

```json
{
// ..
"runArgs": [
// ..
"--cpus=2",,
"--memory=8gb",
// ..
],
// ..
}
```
4 changes: 3 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ pub type Result<T> = result::Result<T, OrcaError>;
/// Possible errors you may encounter.
#[derive(Error, Debug)]
pub(crate) enum Kind {
#[error("Received an empty response when attempting to load the alternate container image file: {path}.")]
#[error(
"Received an empty response when attempting to load the alternate container image file: {path}."
)]
EmptyResponseWhenLoadingContainerAltImage { path: PathBuf },
#[error("Out of generated random names.")]
GeneratedNamesOverflow,
Expand Down
2 changes: 1 addition & 1 deletion src/orchestrator/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ use crate::{
util::get,
};
use bollard::{
Docker,
container::{
Config, CreateContainerOptions, ListContainersOptions, RemoveContainerOptions,
StartContainerOptions, WaitContainerOptions,
},
image::{CreateImageOptions, ImportImageOptions},
models::{ContainerStateStatusEnum, HostConfig},
Docker,
};
use chrono::DateTime;
use futures_util::{
Expand Down
4 changes: 2 additions & 2 deletions src/store/filestore.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use crate::{
error::{Kind, OrcaError, Result},
model::{to_yaml, Annotation, Pod, PodJob, PodResult},
model::{Annotation, Pod, PodJob, PodResult, to_yaml},
store::{ModelID, ModelInfo, Store},
util::get_type_name,
};
use colored::Colorize as _;
use glob::glob;
use heck::ToSnakeCase as _;
use regex::Regex;
use serde::{de::DeserializeOwned, Serialize};
use serde::{Serialize, de::DeserializeOwned};
use serde_yaml;
use std::{
fs,
Expand Down
2 changes: 1 addition & 1 deletion tests/model.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![expect(missing_docs, clippy::panic_in_result_fn, reason = "OK in tests.")]

pub mod fixture;
use fixture::{pod_job_style, pod_result_style, pod_style, NAMESPACE_LOOKUP_READ_ONLY};
use fixture::{NAMESPACE_LOOKUP_READ_ONLY, pod_job_style, pod_result_style, pod_style};
use indoc::indoc;
use orcapod::{error::Result, model::to_yaml};

Expand Down
4 changes: 2 additions & 2 deletions tests/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
)]

pub mod fixture;
use fixture::{container_image_style, pod_job_style, TestContainerImage, TestDirs};
use fixture::{TestContainerImage, TestDirs, container_image_style, pod_job_style};
use orcapod::{
error::Result,
model::OrcaPath,
orchestrator::{docker::LocalDockerOrchestrator, ImageKind, Orchestrator as _, PodRun, Status},
orchestrator::{ImageKind, Orchestrator as _, PodRun, Status, docker::LocalDockerOrchestrator},
};
use std::{collections::HashMap, path::PathBuf};

Expand Down
6 changes: 3 additions & 3 deletions tests/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

pub mod fixture;
use fixture::{
pod_job_style, pod_result_style, pod_style, TestDirs, TestSetup, NAMESPACE_LOOKUP_READ_ONLY,
NAMESPACE_LOOKUP_READ_ONLY, TestDirs, TestSetup, pod_job_style, pod_result_style, pod_style,
};
use orcapod::{
crypto::hash_buffer,
error::Result,
model::{to_yaml, Annotation, Pod},
store::{filestore::LocalFileStore, ModelID, ModelInfo, Store as _},
model::{Annotation, Pod, to_yaml},
store::{ModelID, ModelInfo, Store as _, filestore::LocalFileStore},
};
use std::{collections::HashMap, fmt::Debug, path::Path};

Expand Down