-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import os | ||
import uuid | ||
|
||
from toil.provisioners import cluster_factory | ||
from toil.test.provisioners.clusterTest import AbstractClusterTest | ||
|
||
|
||
class CactusIntegrationTest(AbstractClusterTest): | ||
""" | ||
Run the Cactus Integration test on a Kubernetes AWS cluster | ||
""" | ||
|
||
def __init__(self, methodName): | ||
super().__init__(methodName=methodName) | ||
self.clusterName = "cactus-test-" + str(uuid.uuid4()) | ||
self.leaderNodeType = "t2.medium" | ||
self.clusterType = "kubernetes" | ||
|
||
def setUp(self): | ||
super().setUp() | ||
self.jobStore = f"aws:{self.awsRegion()}:cluster-{uuid.uuid4()}" | ||
|
||
def test_cactus_integration(self): | ||
# Make a cluster with worker nodes | ||
self.createClusterUtil(args=["--nodeTypes=t2.xlarge", "-w=1-3"]) | ||
print("cluster created") | ||
# get the leader so we know the IP address - we don't need to wait since create cluster | ||
# already ensures the leader is running | ||
self.cluster = cluster_factory( | ||
provisioner="aws", zone=self.zone, clusterName=self.clusterName | ||
) | ||
self.leader = self.cluster.getLeader() | ||
|
||
CACTUS_COMMIT_SHA = os.environ["CACTUS_COMMIT_SHA"] or "f5adf4013326322ae58ef1eccb8409b71d761583" # default cactus commit | ||
|
||
# command to install and run cactus on the cluster | ||
print("running cactus") | ||
cactus_command = ("python -m virtualenv --system-site-packages venv && " | ||
". venv/bin/activate && " | ||
"git clone https://github.com/ComparativeGenomicsToolkit/cactus.git --recursive && " | ||
"cd cactus && " | ||
"git fetch origin && " | ||
f"git checkout {CACTUS_COMMIT_SHA} && " | ||
"git submodule update --init --recursive && " | ||
"pip install --upgrade 'setuptools<66' pip && " | ||
"pip install --upgrade . && " | ||
"pip install --upgrade numpy psutil && " | ||
"time cactus --setEnv SINGULARITY_DOCKER_HUB_MIRROR --batchSystem kubernetes --retryCount=3 " | ||
f"--consCores 2 --binariesMode singularity --clean always {self.jobStore} " | ||
"examples/evolverMammals.txt examples/evolverMammals.hal --root mr --defaultDisk 8G --logDebug") | ||
|
||
# run cactus | ||
self.sshUtil( | ||
[ | ||
"bash", | ||
"-c", | ||
cactus_command | ||
] | ||
) | ||
|