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

👽️ Resolve relative paths and links right at the beginning of a run #1551

Closed
wants to merge 23 commits into from

Conversation

shnizzedy
Copy link
Member

@shnizzedy shnizzedy commented Aug 19, 2021

Fixes

Description

  • Makes C-PAC more accepting of relative paths and/or links in addition to absolute paths.
  • Updates get_resource_from_prov to return None if prov is empty.
  • Returns an exit code of 1 when C-PAC finishes with an error.

These changes should resolve a few crashes but shouldn't alter any outputs from runs that were already succeeding.

Technical details

The main thing here is setting local variables bids_dir and output_dir to os.path.realpath() of the passed args immediately after parsing the args

# get the command line arguments
args = parser.parse_args(
sys.argv[
1:(
sys.argv.index('--')
if '--' in sys.argv
else len(sys.argv)
)
]
)
bids_dir_is_s3 = args.bids_dir.lower().startswith("s3://")
bids_dir = args.bids_dir if bids_dir_is_s3 else os.path.realpath(
args.bids_dir)
output_dir_is_s3 = args.output_dir.lower().startswith("s3://")
output_dir = args.output_dir if output_dir_is_s3 else os.path.realpath(
args.output_dir)

and then using those local variables everywhere we were using args.bids_dir and args.output_dir

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the develop branch of the repository.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I updated the changelog.
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@shnizzedy shnizzedy marked this pull request as ready for review August 20, 2021 15:07
@shnizzedy shnizzedy marked this pull request as draft August 24, 2021 14:51
@shnizzedy
Copy link
Member Author

I think FCP-INDI/app-C-PAC-brainlife.io#13 is directly related to this PR. Re-running that Brainlife run on the dev branch to confirm.

@shnizzedy
Copy link
Member Author

shnizzedy commented Sep 23, 2021

Included in #1531

@shnizzedy shnizzedy closed this Sep 23, 2021
This was referenced Sep 23, 2021
@shnizzedy shnizzedy deleted the enh/allow-links branch November 6, 2023 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant