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

fix: iRODS functionality - issue #1510 #1611

Merged
merged 5 commits into from May 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 14 additions & 3 deletions snakemake/remote/iRODS.py
Expand Up @@ -24,7 +24,11 @@
from irods.session import iRODSSession
from irods.meta import iRODSMeta
from irods.models import DataObject
from irods.exception import CollectionDoesNotExist, DataObjectDoesNotExist
from irods.exception import (
CollectionDoesNotExist,
DataObjectDoesNotExist,
CAT_NO_ACCESS_PERMISSION,
)
import irods.keywords as kw
except ImportError as e:
raise WorkflowError(
Expand Down Expand Up @@ -90,6 +94,10 @@ def available_protocols(self):
"""List of valid protocols for this remote provider."""
return ["irods://"]

def glob_wildcards(self, pattern, *args, **kwargs):
remote_pattern = os.path.join(os.sep, self._irods_session.zone, pattern)
return super().glob_wildcards(remote_pattern, *args, **kwargs)


class RemoteObject(AbstractRemoteRetryObject):
"""This is a class to interact with an iRODS server."""
Expand Down Expand Up @@ -200,13 +208,16 @@ def _upload(self):

# create folder structure on remote
folders = os.path.dirname(self.remote_path).split(os.sep)[1:]
collpath = os.sep
# add zone name to path
collpath = os.sep + folders.pop(0) + os.sep + folders.pop(0)

for folder in folders:
collpath = os.path.join(collpath, folder)

try:
self._irods_session.collections.get(collpath)
# ignore subdirectories where user does not have access
except (CAT_NO_ACCESS_PERMISSION):
pass
except:
self._irods_session.collections.create(collpath)

Expand Down