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

feat: Allow gcs paths without prefix #16

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

project-defiant
Copy link
Collaborator

Context

I want to use google cloud storage paths that do not have prefix like gs://gwas_catalog_data/manifests/ with the GCSPath object. This will be required for data relocation within the genetics_etl dag.

Currently GCSPath object regex requires path to have prefix and filename groups which prevents us from using paths without the prefix, or paths that point directly to the directories within this class.

Implementation

This PR tries to solve it by changing the regex pattern to catch path instead of filename and prefix and extract the logic behind pathfilename and prefix parsing to the GCSPath.segments method.

  • Refactored POSIX_PATH_PATTERN to capture path instead of prefix and filename.
  • Refactored GCSPath.segments and GCSPath.path methods to preserve backwards compatibility.
  • Added tests for GCSPath object.

@project-defiant project-defiant added the enhancement New feature or request label Sep 10, 2024
src/ot_orchestration/utils/path.py Outdated Show resolved Hide resolved
src/ot_orchestration/utils/path.py Outdated Show resolved Hide resolved
@javfg
Copy link
Member

javfg commented Sep 10, 2024

Looks good!

@project-defiant project-defiant merged commit 0f2fc02 into dev Sep 10, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants