Skip to content

Commit

Permalink
Update config variable names
Browse files Browse the repository at this point in the history
I updated `registry` to `container_registry` in anticipation of a future where we
support different data registries as well, per @agitter's suggestion. I also changed
the `config.framework` variable to `config.container_framework` to be more clear
what this variable is supposed to contain.
  • Loading branch information
jhiemstrawisc committed Sep 29, 2023
1 parent 229cd84 commit 41f9ec8
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ algorithm_directed = _config.config.algorithm_directed
pca_params = _config.config.pca_params
hac_params = _config.config.hac_params

FRAMEWORK = _config.config.framework
FRAMEWORK = _config.config.container_framework
print(f"Running {FRAMEWORK} containers")

# Return the dataset dictionary from the config file given the label
Expand Down
2 changes: 1 addition & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ singularity: false
# Allow the user to configure which container registry containers should be pulled from
# Note that this assumes container names are consistent across registries, and that the
# registry being passed doesn't require authentication for pull actions
registry:
container_registry:
base_url: docker.io
# The owner or project of the registry
# For example, "reedcompbio" if the image is available as docker.io/reedcompbio/allpairs
Expand Down
2 changes: 1 addition & 1 deletion src/allpairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def run(nodetypes=None, network=None, output_file=None):

print('Running All Pairs Shortest Paths with arguments: {}'.format(' '.join(command)), flush=True)

container_framework = config.config.framework
container_framework = config.config.container_framework
container_suffix = "allpairs"

out = run_container(
Expand Down
10 changes: 5 additions & 5 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# value. For example
#
# import spras.config as config
# container_framework = config.config.framework
# container_framework = config.config.container_framework
#
# will grab the top level registry configuration option as it appears in the config file

Expand Down Expand Up @@ -65,13 +65,13 @@ def process_config(self, raw_config):
self.out_dir = raw_config["reconstruction_settings"]["locations"]["reconstruction_dir"]

if "singularity" in raw_config and raw_config["singularity"]:
self.framework = "singularity"
self.container_framework = "singularity"
else:
self.framework = "docker"
self.container_framework = "docker"

# Grab registry from the config, and if none is provided default to docker
if "registry" in raw_config and raw_config["registry"]["base_url"] != "" and raw_config["registry"]["owner"] != "":
self.container_prefix = raw_config["registry"]["base_url"] + "/" + raw_config["registry"]["owner"]
if "container_registry" in raw_config and raw_config["container_registry"]["base_url"] != "" and raw_config["container_registry"]["owner"] != "":
self.container_prefix = raw_config["container_registry"]["base_url"] + "/" + raw_config["container_registry"]["owner"]
else:
self.container_prefix = DEFAULT_CONTAINER_PREFIX

Expand Down
2 changes: 1 addition & 1 deletion src/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def run_container(framework: str, container_suffix: str, command: List[str], vol
elif normalized_framework == 'singularity':
return run_container_singularity(container, command, volumes, working_dir, environment)
else:
raise ValueError(f'{config.config.framework} is not a recognized container framework. Choose "docker" or "singularity".')
raise ValueError(f'{config.config.container_framework} is not a recognized container framework. Choose "docker" or "singularity".')


# TODO any issue with creating a new client each time inside this function?
Expand Down
2 changes: 1 addition & 1 deletion src/domino.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def run(network=None, active_genes=None, output_file=None, slice_threshold=None,

print('Running slicer with arguments: {}'.format(' '.join(slicer_command)), flush=True)

container_framework = config.config.framework
container_framework = config.config.container_framework
container_suffix = "domino"
slicer_out = run_container(container_framework,
container_suffix,
Expand Down
2 changes: 1 addition & 1 deletion src/meo.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def run(edges=None, sources=None, targets=None, output_file=None, max_path_lengt
print('Running Maximum Edge Orientation with arguments: {}'.format(' '.join(command)), flush=True)

# TODO consider making this a string in the config file instead of a Boolean
container_framework = config.config.framework
container_framework = config.config.container_framework
container_suffix = "meo"
out = run_container(container_framework,
container_suffix,
Expand Down
2 changes: 1 addition & 1 deletion src/mincostflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def run(sources=None, targets=None, edges=None, output_file=None, flow=None, cap
command.extend(['--capacity', str(capacity)])

# choosing to run in docker or singularity container
container_framework = config.config.framework
container_framework = config.config.container_framework
container_suffix = "mincostflow"

# constructs a docker run call
Expand Down
2 changes: 1 addition & 1 deletion src/omicsintegrator1.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def run(edges=None, prizes=None, dummy_mode=None, mu_squared=None, exclude_terms
print('Running Omics Integrator 1 with arguments: {}'.format(' '.join(command)), flush=True)

# TODO consider making this a string in the config file instead of a Boolean
container_framework = config.config.framework
container_framework = config.config.container_framework
container_suffix = "omics-integrator-1:no-conda" # no-conda version is the default

out = run_container(container_framework,
Expand Down
2 changes: 1 addition & 1 deletion src/omicsintegrator2.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def run(edges=None, prizes=None, output_file=None, w=None, b=None, g=None, noise

print('Running Omics Integrator 2 with arguments: {}'.format(' '.join(command)), flush=True)

container_framework = config.config.framework
container_framework = config.config.container_framework
container_suffix = "omics-integrator-2:v2"
out = run_container(container_framework,
container_suffix,
Expand Down
2 changes: 1 addition & 1 deletion src/pathlinker.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def run(nodetypes=None, network=None, output_file=None, k=None):

print('Running PathLinker with arguments: {}'.format(' '.join(command)), flush=True)

container_framework = config.config.framework
container_framework = config.config.container_framework
container_suffix = "pathlinker"
out = run_container(container_framework,
container_suffix,
Expand Down
4 changes: 2 additions & 2 deletions test/AllPairs/test_ap.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ def test_allpairs_singularity(self):
out_path = Path(OUT_DIR+'sample-out.txt')
out_path.unlink(missing_ok=True)
# Only include required arguments and run with Singularity
config.config.framework = "singularity"
config.config.container_framework = "singularity"
AllPairs.run(
nodetypes=TEST_DIR+'input/sample-in-nodetypes.txt',
network=TEST_DIR+'input/sample-in-net.txt',
output_file=str(out_path)
)
config.config.framework = "docker"
config.config.container_framework = "docker"
assert out_path.exists()

def test_allpairs_correctness(self):
Expand Down
4 changes: 2 additions & 2 deletions test/DOMINO/test_domino.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ def test_domino_singularity(self):
out_path = Path(OUT_FILE_DEFAULT)
out_path.unlink(missing_ok=True)
# Only include required arguments and run with Singularity
config.config.framework = "singularity"
config.config.container_framework = "singularity"
DOMINO.run(
network=TEST_DIR+'input/domino-network.txt',
active_genes=TEST_DIR+'input/domino-active-genes.txt',
output_file=OUT_FILE_DEFAULT)
assert out_path.exists()
config.config.framework = "docker"
config.config.container_framework = "docker"
def test_pre_id_transform(self):
"""
Test the node ID transformation run before DOMINO executes
Expand Down
4 changes: 2 additions & 2 deletions test/MEO/test_meo.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def test_meo_singularity(self):
out_path = Path(OUT_FILE)
out_path.unlink(missing_ok=True)
# Only include required arguments and run with Singularity
config.config.framework = "singularity"
config.config.container_framework = "singularity"
MEO.run(edges=TEST_DIR + 'input/meo-edges.txt',
sources=TEST_DIR + 'input/meo-sources.txt',
targets=TEST_DIR + 'input/meo-targets.txt',
output_file=OUT_FILE)
config.config.framework = "docker"
config.config.container_framework = "docker"
assert out_path.exists()
4 changes: 2 additions & 2 deletions test/MinCostFlow/test_mcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ def test_mincostflow_singularity(self, graph):
out_path = Path(OUT_FILE)
out_path.unlink(missing_ok=True)
# Include all optional arguments
config.config.framework = "singularity"
config.config.container_framework = "singularity"
MinCostFlow.run(sources=TEST_DIR + 'input/' + graph + '/sources.txt',
targets=TEST_DIR + 'input/' + graph + '/targets.txt',
edges=TEST_DIR + 'input/' + graph + '/edges.txt',
output_file=OUT_FILE,
flow=1,
capacity=1)
config.config.framework = "docker"
config.config.container_framework = "docker"
assert out_path.exists()

4 changes: 2 additions & 2 deletions test/OmicsIntegrator1/test_oi1.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ def test_oi1_singularity(self):
out_path = Path(OUT_FILE)
out_path.unlink(missing_ok=True)
# Only include required arguments and run with Singularity
config.config.framework = "singularity"
config.config.container_framework = "singularity"
OmicsIntegrator1.run(edges=TEST_DIR + 'input/oi1-edges.txt',
prizes=TEST_DIR + 'input/oi1-prizes.txt',
output_file=OUT_FILE,
w=5,
b=1,
d=10)
config.config.framework = "docker"
config.config.container_framework = "docker"
assert out_path.exists()
4 changes: 2 additions & 2 deletions test/OmicsIntegrator2/test_oi2.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ def test_oi2_missing(self):
def test_oi2_singularity(self):
# Only include required arguments
OUT_FILE.unlink(missing_ok=True)
config.config.framework = "singularity"
config.config.container_framework = "singularity"
OmicsIntegrator2.run(edges=EDGE_FILE,
prizes=PRIZE_FILE,
output_file=OUT_FILE)
config.config.framework = "docker"
config.config.container_framework = "docker"
assert OUT_FILE.exists()
4 changes: 2 additions & 2 deletions test/PathLinker/test_pathlinker.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ def test_pathlinker_singularity(self):
out_path = Path(OUT_FILE_DEFAULT)
out_path.unlink(missing_ok=True)
# Only include required arguments and run with Singularity
config.config.framework = "singularity"
config.config.container_framework = "singularity"
PathLinker.run(
nodetypes=TEST_DIR+'input/sample-in-nodetypes.txt',
network=TEST_DIR+'input/sample-in-net.txt',
output_file=OUT_FILE_DEFAULT,
)
config.config.framework = "docker"
config.config.container_framework = "docker"
assert out_path.exists()

0 comments on commit 41f9ec8

Please sign in to comment.