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

🐛 Move pipeline import earlier in configuration process #1437

Merged
merged 1 commit into from
Feb 15, 2021

Conversation

shnizzedy
Copy link
Member

Fixes

Fixes

Running the 'fmriprep-options' pre-configured pipeline.
Traceback (most recent call last):
  File "/code/run.py", line 524, in <module>
    c['pipeline_setup']['system_config']['max_cores_per_participant'], int(c['pipeline_setup']['system_config']['num_ants_threads'])
KeyError: 'num_ants_threads'

by @shnizzedy

Related to #1435 by @shnizzedy

Description

  1. Moves the conversion of a pipeline config dict to a Configruration object from after
    # get the aws_input_credentials, if any are specified
    if args.aws_input_creds:
    c['awsCredentialsFile'] = resolve_aws_credential(args.aws_input_creds)
    if args.aws_output_creds:
    c['pipeline_setup']['Amazon-AWS']['aws_output_bucket_credentials'] = resolve_aws_credential(
    args.aws_output_creds
    )
    c['pipeline_setup']['output_directory']['path'] = os.path.join(args.output_dir, "output")
    if "s3://" not in args.output_dir.lower():
    c['pipeline_setup']['log_directory']['path'] = os.path.join(args.output_dir, "log")
    else:
    c['pipeline_setup']['log_directory']['path'] = os.path.join(DEFAULT_TMP_DIR, "log")
    if args.mem_gb:
    c['pipeline_setup']['system_config']['maximum_memory_per_participant'] = float(args.mem_gb)
    elif args.mem_mb:
    c['pipeline_setup']['system_config']['maximum_memory_per_participant'] = float(args.mem_mb) / 1024.0
    else:
    c['pipeline_setup']['system_config']['maximum_memory_per_participant'] = 6.0
    # Preference: n_cpus if given, override if present, else from config if
    # present, else n_cpus=3
    if args.n_cpus == 0:
    c['pipeline_setup']['system_config']['max_cores_per_participant'] = int(c['pipeline_setup']['system_config'].get('max_cores_per_participant', 3))
    args.n_cpus = 3
    else:
    c['pipeline_setup']['system_config']['max_cores_per_participant'] = args.n_cpus
    c['pipeline_setup']['system_config']['num_participants_at_once'] = int(c['pipeline_setup']['system_config'].get('num_participants_at_once', 1))
    # Reduce cores per participant if cores times particiapants is more than
    # available CPUS. n_cpus is a hard upper limit.
    if (c['pipeline_setup']['system_config']['max_cores_per_participant'] * c['pipeline_setup']['system_config']['num_participants_at_once']) > int(
    args.n_cpus
    ):
    c['pipeline_setup']['system_config']['max_cores_per_participant'] = int(
    args.n_cpus
    ) // c['pipeline_setup']['system_config']['num_participants_at_once']
    c['pipeline_setup']['system_config']['num_ants_threads'] = min(
    c['pipeline_setup']['system_config']['max_cores_per_participant'], int(c['pipeline_setup']['system_config']['num_ants_threads'])
    )
    to before.
  2. Sets imported pipleine base to 'anat-only' if args.anat_only

Technical details

I overshot where to do this type conversion in #1435

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the develop_v1.8_convergence 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 added this to the 1.8 Release milestone Feb 15, 2021
@sgiavasis sgiavasis merged commit 42eff6a into develop_v1.8_convergence Feb 15, 2021
@shnizzedy shnizzedy deleted the fix/import-pipeline branch February 19, 2021 20:42
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.

2 participants