Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reenable some Kubernetes CI tests #4604

Merged
merged 23 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4d57bf9
Reenable kubernetes tests that don't require a local cluster, eg CWL on
stxue1 Sep 22, 2023
16dbd67
Merge branch 'master' into issues/4601-reenable-nonlocal-kubernetes
stxue1 Sep 22, 2023
5cb2810
Disable CWL kubernetes
stxue1 Sep 25, 2023
611280e
Merge branch 'issues/4601-reenable-nonlocal-kubernetes' of github.com…
stxue1 Sep 25, 2023
7eb5782
Merge branch 'master' into issues/4601-reenable-nonlocal-kubernetes
adamnovak Oct 26, 2023
6e513ab
enable cactus tests
stxue1 Nov 9, 2023
a942f41
Merge branch 'master' of github.com:DataBiosphere/toil into issues/46…
stxue1 Nov 9, 2023
45ee1fc
Add to scheduled integration tests
stxue1 Nov 9, 2023
aacf3e1
Merge branch 'issues/4601-reenable-nonlocal-kubernetes' of github.com…
stxue1 Nov 9, 2023
43caf6e
Add forgotten file
stxue1 Nov 9, 2023
1f78af3
Remove print statements
stxue1 Nov 9, 2023
fe06169
Merge branch 'master' into issues/4601-reenable-nonlocal-kubernetes
adamnovak Nov 13, 2023
2ed0a77
Remove unnecessary env var and move file
stxue1 Nov 14, 2023
4698385
Run test when updated
stxue1 Nov 14, 2023
2034c18
update gitlab
stxue1 Nov 14, 2023
fdf7551
Merge branch 'issues/4601-reenable-nonlocal-kubernetes' of github.com…
stxue1 Nov 14, 2023
dc0cb63
Fix typo in path
stxue1 Nov 14, 2023
d625a08
Merge branch 'master' into issues/4601-reenable-nonlocal-kubernetes
adamnovak Nov 15, 2023
c8af0a8
Add virtualenv and prepare build to gitlab CI to run tests properly
stxue1 Nov 15, 2023
6966d11
add gitlab setup scripts
stxue1 Nov 16, 2023
2a59345
add gitlab setup scripts
stxue1 Nov 16, 2023
5659cdb
Merge branch 'issues/4601-reenable-nonlocal-kubernetes' of github.com…
stxue1 Nov 16, 2023
f3deda1
Merge branch 'master' into issues/4601-reenable-nonlocal-kubernetes
stxue1 Nov 16, 2023
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
47 changes: 19 additions & 28 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -398,31 +398,22 @@ mesos:
- make test threads="${TEST_THREADS}" src/toil/test/src/promisedRequirementTest.py::MesosPromisedRequirementsTest

# Cactus-on-Kubernetes integration (as a script and not a pytest test)
#cactus_integration:
# stage: integration
# script:
# - set -e
# - ${MAIN_PYTHON_PKG} -m virtualenv --system-site-packages venv
# - . venv/bin/activate
# - pip install -U pip wheel
# - pip install .[aws]
# - export TOIL_KUBERNETES_OWNER=toiltest
# - export TOIL_AWS_SECRET_NAME=shared-s3-credentials
# - export TOIL_KUBERNETES_HOST_PATH=/data/scratch
# - export TOIL_WORKDIR=/var/lib/toil
# - export SINGULARITY_CACHEDIR=/var/lib/toil/singularity-cache
# - mkdir -p ${TOIL_WORKDIR}
# - BUCKET_NAME=toil-test-$RANDOM-$RANDOM-$RANDOM
# - cd
# - git clone https://github.com/ComparativeGenomicsToolkit/cactus.git --recursive
# - cd cactus
# - git fetch origin
# - git checkout f5adf4013326322ae58ef1eccb8409b71d761583
# - git submodule update --init --recursive
# # We can't use setuptools 66 on Ubuntu due to https://github.com/pypa/setuptools/issues/3772
# - pip install --upgrade 'setuptools<66' pip
# - pip install --upgrade .
# - pip install --upgrade numpy psutil # Cactus installs an old psutil that Toil isn't compatible with. TODO: Do we really need Numpy?
# - if [[ ! -z "${KUBERNETES_DOCKER_HUB_MIRROR}" ]] ; then export SINGULARITY_DOCKER_HUB_MIRROR="${KUBERNETES_DOCKER_HUB_MIRROR}" ; fi
# - toil clean aws:us-west-2:${BUCKET_NAME}
# - time cactus --setEnv SINGULARITY_DOCKER_HUB_MIRROR --batchSystem kubernetes --retryCount=3 --consCores 2 --binariesMode singularity --clean always aws:us-west-2:${BUCKET_NAME} examples/evolverMammals.txt examples/evolverMammals.hal --root mr --defaultDisk "8G" --logDebug
cactus_integration:
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
changes:
compare_to: 'refs/heads/master'
paths:
- 'src/toil/test/cactus/test_cactus_integration.py'
stage: integration
script:
- export CACTUS_COMMIT_SHA=f5adf4013326322ae58ef1eccb8409b71d761583
- set -e
- ${MAIN_PYTHON_PKG} -m virtualenv venv && . venv/bin/activate && make prepare && make develop extras=[aws]
- python setup_gitlab_docker.py # login to increase the docker.io rate limit
# This reads GITLAB_SECRET_FILE_SSH_KEYS
- python setup_gitlab_ssh.py
- chmod 400 /root/.ssh/id_rsa
- make test tests=src/toil/test/cactus/test_cactus_integration.py
58 changes: 58 additions & 0 deletions src/toil/test/cactus/test_cactus_integration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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"])
# 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
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 --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
]
)