Skip to content

Commit

Permalink
Merge pull request #316 from mskcc/release/1.28.0
Browse files Browse the repository at this point in the history
Release 1.28.0
  • Loading branch information
sivkovic authored Jun 20, 2023
2 parents f48bace + 2ee51ff commit 49edd76
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 21 deletions.
9 changes: 5 additions & 4 deletions orchestrator/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,16 @@ def terminate_job(job):


def set_permission(job):
root_dir = job.base_dir
first_dir = job.root_dir.replace(job.base_dir, "").split("/")[0]
permissions_dir = "/".join([job.base_dir, first_dir]).replace("//", "/")
permission_str = job.root_permission
try:
permission_octal = int(permission_str, 8)
except Exception:
raise TypeError("Could not convert %s to permission octal" % str(permission_str))
try:
os.chmod(root_dir, permission_octal)
for root, dirs, files in os.walk(root_dir):
os.chmod(permissions_dir, permission_octal)
for root, dirs, files in os.walk(permissions_dir):
for single_dir in dirs:
if oct(os.lstat(os.path.join(root, single_dir)).st_mode)[-3:] != permission_octal:
logger.info(f"Setting permissions for {os.path.join(root, single_dir)}")
Expand All @@ -293,7 +294,7 @@ def set_permission(job):
logger.info(f"Setting permissions for {os.path.join(root, single_file)}")
os.chmod(os.path.join(root, single_file), permission_octal)
except Exception:
raise RuntimeError("Failed to change permission of directory %s" % root_dir)
raise RuntimeError("Failed to change permission of directory %s" % permissions_dir)


# Cleaning jobs
Expand Down
3 changes: 2 additions & 1 deletion orchestrator/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def test_permission(self):
}
},
root_dir=temp_path,
base_dir=temp_path,
base_dir="/".join(temp_path.split("/")[:-1]) + "/",
root_permission=expected_permission,
external_id="ext_id",
status=Status.COMPLETED,
Expand All @@ -428,6 +428,7 @@ def test_permission_wrong_permission(self):
}
},
root_dir=temp_path,
base_dir="/".join(temp_path.split("/")[:-1]) + "/",
root_permission=expected_permission,
external_id="ext_id",
status=Status.COMPLETED,
Expand Down
2 changes: 1 addition & 1 deletion ridgeback/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.27.1"
__version__ = "1.28.0"
Binary file added tests/data/toil_3.21.0.tar.gz
Binary file not shown.
Binary file added tests/data/toil_5.4.0a1.tar.gz
Binary file not shown.
24 changes: 9 additions & 15 deletions tests/test_commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
Tests for commandline status handling
"""
import os
from shutil import unpack_archive, copytree
from shutil import unpack_archive, copytree, copy
import tempfile
import requests
from django.test import TestCase, override_settings
import toil
from orchestrator.models import Job, Status, PipelineType, CommandLineToolJob
Expand All @@ -16,24 +15,19 @@ class TestToil(TestCase):
Test toil track functions
"""

def download_toil_mock(self, toil_version):
def get_toil_mock(self, toil_version):
"""
Download TOIL mock data from s3
"""
download_url = "https://toilmock.s3.amazonaws.com/toil_%s.tar.gz" % toil_version
download_path = "toil_%s.tar.gz" % toil_version
resource_name = "toil_%s.tar.gz" % toil_version
resource_path = os.path.join(os.path.dirname(__file__), "data", resource_name)
folder_path = "toil_%s" % toil_version
download_full_path = os.path.join(self.mock_dir.name, download_path)
self.mock_full_path = os.path.join(self.mock_dir.name, folder_path)
if not os.path.exists(download_full_path):
response = requests.get(download_url, stream=True)
if response.status_code == 200:
with open(download_full_path, "wb") as download:
download.write(response.raw.read())
else:
raise Exception("Could not download TOIL mock data from: %s" % download_url)
if not os.path.exists(resource_path):
raise Exception("Could not find TOIL mock data from: %s" % resource_path)
if not os.path.exists(self.mock_full_path):
unpack_archive(download_full_path, self.mock_dir.name)
copy(resource_path, self.mock_dir.name)
unpack_archive(resource_path, self.mock_dir.name)

def setUp(self):
Job.objects.all().delete()
Expand All @@ -50,7 +44,7 @@ def setUp(self):
status=Status.RUNNING,
)
self.job.save()
self.download_toil_mock(self.toil_version)
self.get_toil_mock(self.toil_version)

def tearDown(self):
self.mock_dir.cleanup()
Expand Down

0 comments on commit 49edd76

Please # to comment.