Skip to content

Commit a34d62f

Browse files
committed
Add native executor and add dir_guard::ensure_dir_signature in util
1 parent 7870334 commit a34d62f

File tree

8 files changed

+417
-6
lines changed

8 files changed

+417
-6
lines changed

Cargo.lock

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ all = ["docker-tests", "hpc-tests", "high-memory-tests"]
1313

1414
[dependencies]
1515
anyhow = "1.0.100"
16+
blake3 = "1.8.2"
1617
clap = { version = "4.5.51", features = ["derive"] }
1718
home = "0.5.12"
1819
paste = "1.0.15"
1920
shell-escape = "0.1.5"
2021
strum = { version = "0.27.2", features = ["derive"] }
22+
which = "8.0.0"
2123
yansi = "1.0.1"
2224

2325
[target.'cfg(unix)'.dependencies]

assets/pixi/rfdiffusion.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[workspace]
2+
name = "rfdiffusion"
3+
version = "0.0.1"
4+
description = "Pixi environment for https://github.com/RosettaCommons/rc RFdiffusion app"
5+
# platforms = ["linux-64"]
6+
platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"]
7+
channels = ["conda-forge", "pytorch", "dglteam", "nvidia"]
8+
9+
[dependencies]
10+
python = "==3.9"
11+
pip = "*"
12+
13+
[tasks]
14+
install = """
15+
( rm -rf rfdiffusion-repo-clone ; git clone https://github.com/RosettaCommons/RFdiffusion.git rfdiffusion-repo-clone ) \
16+
&& pip install \
17+
dgl==1.0.2+cu116 -f https://data.dgl.ai/wheels/cu116/repo.html \
18+
torch==1.12.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116 \
19+
e3nn==0.3.3 \
20+
wandb==0.12.0 \
21+
pynvml==11.0.0 \
22+
git+https://github.com/NVIDIA/dllogger#egg=dllogger \
23+
decorator==5.1.0 \
24+
hydra-core==1.3.2 \
25+
pyrsistent==0.19.3 \
26+
&& pip install --no-cache-dir rfdiffusion-repo-clone/env/SE3Transformer \
27+
&& pip install --no-cache-dir -e rfdiffusion-repo-clone/ --no-deps \
28+
"""
29+
30+
setup = { depends-on = ["install"] }

src/executor.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
mod docker;
22
mod hpc_container;
3+
mod native;
34

45
use std::path::{Path, PathBuf};
56

@@ -36,7 +37,7 @@ impl Executor {
3637
self.execute_with_hpc_container_engine(spec)
3738
}
3839

39-
ContainerEngine::None => todo!("ContainerEngine::None"),
40+
ContainerEngine::None => self.execute_native(spec),
4041
}
4142
}
4243

src/executor/hpc_container.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl Executor {
112112
}
113113

114114
fn images_root(&self) -> PathBuf {
115-
let root = home_dir().unwrap().join(".cache/rosettacommons/rc");
115+
let root = home_dir().unwrap().join(".cache/rosettacommons/rc/hpc");
116116
std::fs::create_dir_all(&root).unwrap();
117117
root
118118
}

src/executor/native.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
use anyhow::Result;
2+
use anyhow::anyhow;
3+
use yansi::Paint;
4+
5+
use crate::util::ensure_dir_signature;
6+
use crate::{ContainerEngine, app::RunSpec, executor::Executor};
7+
8+
impl Executor {
9+
pub(super) fn execute_native(&self, _spec: RunSpec) -> Result<()> {
10+
assert!(matches!(self.engine, ContainerEngine::None));
11+
12+
Self::check_if_pixi_is_installed()?;
13+
14+
let pixi_evn_root = self.working_dir.join(format!("{}.pixi", self.app));
15+
16+
ensure_dir_signature(&pixi_evn_root, &["qwe", &_spec.image.0], |_d| Ok(()))?;
17+
18+
//write_signature(&self.root, &hash.to_string())?;
19+
20+
todo!("ContainerEngine::None")
21+
}
22+
23+
/// Check if Pixi is installed
24+
fn check_if_pixi_is_installed() -> Result<()> {
25+
match which::which("pixi") {
26+
Ok(_) => Ok(()),
27+
Err(_) => Err(anyhow!(
28+
"Pixi is not installed or not in PATH, please run `{}` to install Pixi or visit {} for more information",
29+
"curl -fsSL https://pixi.sh/install.sh | sh".green(),
30+
"https://pixi.sh".bright_blue().underline()
31+
)),
32+
}
33+
}
34+
}

src/util.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#![allow(unused_imports)]
22

33
mod command;
4+
mod dir_guard;
45
mod yansi;
56

6-
pub use command::Command;
7-
8-
pub use yansi::{Paint, PaintExt};
9-
107
use std::io::{self, Write};
118
use std::time::Duration;
129

10+
pub use command::Command;
11+
pub use dir_guard::ensure_dir_signature;
12+
pub use yansi::{Paint, PaintExt};
13+
1314
#[allow(dead_code)]
1415
/// Fancy sleep function with a countdown message.
1516
/// Prints: "{message}... sleeping... {time_left}"

0 commit comments

Comments
 (0)