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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Tools development version

- Fix bug in `ccbr_tools install` where CCBR/Tools & CCBR/actions were using incorrect repo names. (#53, @kelly-sovacool)

## Tools 0.3.0

- Allow relaxed version with only major and minor components in `match_semver()` with `strict_semver=False`. (#49, @kelly-sovacool)
Expand Down
4 changes: 2 additions & 2 deletions src/ccbr_tools/pipeline/hpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Biowulf(Cluster):
GROUP = "CCBR_Pipeliner"
PIPELINES_HOME = pathlib.Path("/data/CCBR_Pipeliner/Pipelines")
TOOLS_HOME = pathlib.Path("/data/CCBR_Pipeliner/Tools")
CONDA_ACTIVATE = '. "/data/CCBR_Pipeliner/db/PipeDB/Conda/etc/profile.d/conda.sh && conda activate py311'
CONDA_ACTIVATE = '. "/data/CCBR_Pipeliner/db/PipeDB/Conda/etc/profile.d/conda.sh" && conda activate py311'

def __init__(self):
super().__init__()
Expand Down Expand Up @@ -101,7 +101,7 @@ class FRCE(Cluster):
GROUP = "nci-frederick-ccbr-pipelines"
PIPELINES_HOME = pathlib.Path("/mnt/projects/CCBR-Pipelines/pipelines")
TOOLS_HOME = pathlib.Path("/mnt/projects/CCBR-Pipelines/tools")
CONDA_ACTIVATE = '. "/mnt/projects/CCBR-Pipelines/resources/miniconda3/etc/profile.d/conda.sh && conda activate py311'
CONDA_ACTIVATE = '. "/mnt/projects/CCBR-Pipelines/resources/miniconda3/etc/profile.d/conda.sh" && conda activate py311'

def __init__(self):
super().__init__()
Expand Down
18 changes: 13 additions & 5 deletions src/ccbr_tools/software.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
self.version_re
), f"Invalid version format '{version}' - Must be a valid semantic version."

def __repr__(self):
return f"{self.__class__.__name__}({self.name}, {self.version})"

Check warning on line 27 in src/ccbr_tools/software.py

View check run for this annotation

Codecov / codecov/patch

src/ccbr_tools/software.py#L27

Added line #L27 was not covered by tests

def path(self, hpc: Cluster, branch_tag=None):
hidden_dir = self.hidden_version if not branch_tag else f".{branch_tag}"
return hpc.TOOLS_HOME / self.name / hidden_dir
Expand Down Expand Up @@ -70,10 +73,15 @@
class PythonTool(Software):
def __init__(self, name, version):
super(PythonTool, self).__init__(name, version)
self.repo_name = name.replace("ccbr_", "")

def install(self, hpc: Cluster, branch_tag=None):
return Installer.python(self, hpc, branch_tag=branch_tag)

@property
def url(self):
return f"https://github.com/CCBR/{self.repo_name}.git"


class BashTool(Software):
def __init__(self, name, version):
Expand Down Expand Up @@ -128,10 +136,10 @@
SET_SYMLINK = """rm -if {MAJOR_MINOR_VERSION}
ln -s {PATH} {MAJOR_MINOR_VERSION}"""

INSTALL_SCRIPT = """newgrp {GROUP}
{CONDA_ACTIVATE}
INSTALL_SCRIPT = """{CONDA_ACTIVATE}
{INSTALL}
chmod -R a+rX {PATH}"""
chmod -R a+rX {PATH}
chown -R :{GROUP} {PATH}"""


def install(
Expand All @@ -148,7 +156,7 @@
script = install_script.format(
GROUP=hpc.GROUP,
CONDA_ACTIVATE=hpc.CONDA_ACTIVATE,
INSTALL=tool.install(hpc),
INSTALL=tool.install(hpc, branch_tag=branch_tag),
PATH=tool.path(hpc),
)
if not tool.is_dev_version:
Expand All @@ -159,4 +167,4 @@
if dryrun:
print(script)
else:
shell_run(script, shell=True, check=True, capture_output=False)
shell_run(script, shell=True, capture_output=False)

Check warning on line 170 in src/ccbr_tools/software.py

View check run for this annotation

Codecov / codecov/patch

src/ccbr_tools/software.py#L170

Added line #L170 was not covered by tests
4 changes: 4 additions & 0 deletions tests/test_pipeline_hpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def test_hpc_biowulf():
hpc.__repr__().startswith(
"<class 'ccbr_tools.pipeline.hpc.Biowulf'>({'name': 'biowulf'"
),
hpc.CONDA_ACTIVATE
== '. "/data/CCBR_Pipeliner/db/PipeDB/Conda/etc/profile.d/conda.sh" && conda activate py311',
]
)

Expand All @@ -25,6 +27,8 @@ def test_hpc_frce():
hpc.name == "frce",
"/mnt/projects/CCBR-Pipelines/bin" in hpc.env_vars,
hpc.singularity_sif_dir == "/mnt/projects/CCBR-Pipelines/SIFs",
hpc.CONDA_ACTIVATE
== '. "/mnt/projects/CCBR-Pipelines/resources/miniconda3/etc/profile.d/conda.sh" && conda activate py311',
]
)

Expand Down
35 changes: 35 additions & 0 deletions tests/test_software.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from ccbr_tools.software import Software
from ccbr_tools.pipeline.hpc import Biowulf


def test_python():
assert all(
[
Software.create_software("ccbr_tools", "v0.3.2").url
== "https://github.com/CCBR/tools.git",
Software.create_software("ccbr_actions", "v0.1.2").url
== "https://github.com/CCBR/actions.git",
Software.create_software("ccbr_actions", "v1.0.0-dev").install(
hpc=Biowulf, branch_tag="main"
)
== "pip install git+https://github.com/CCBR/actions.git@main -t /data/CCBR_Pipeliner/Tools/ccbr_actions/.v1.0.0-dev",
]
)


def test_pipelines():
assert all(
[
Software.create_software("CHAMPAGNE", "v0.3.0").install(hpc=Biowulf)
== "pip install git+https://github.com/CCBR/[email protected] -t /data/CCBR_Pipeliner/Pipelines/CHAMPAGNE/.v0.3.0",
Software.create_software("XAVIER", "v3.0.1").install(hpc=Biowulf)
== "git clone --depth 1 --single-branch --branch v3.0.1 https://github.com/CCBR/XAVIER.git /data/CCBR_Pipeliner/Pipelines/XAVIER/.v3.0.1",
]
)


def test_bash():
assert (
Software.create_software("permfix", "v1.2.3").install(Biowulf)
== "git clone --depth 1 --single-branch --branch v1.2.3 https://github.com/CCBR/permfix.git /data/CCBR_Pipeliner/Tools/permfix/.v1.2.3"
)