Skip to content

Logo Logo

The CLI Config File

Introduction

The Command-Line Interface (CLI) config file is one method for setting the optional flags of a command. A config file is useful when you want to automate tasks or if you need to set many optional flags. This article has a template of a config file as well as steps for how to use it.

Instruction Steps

Example config file format

Below is the example of a YAML config file for the import dicom command.

Tip: Other commands have different optional flags. See the reference guides for the support CLI commands:

Note: the help text for the fw export bids command shows --config as an optional flag. However, the config file is not valid with the export command.

---
#Template of a Flywheel CLI config file
ca-certs: The file to use for SSL Certificate Validation
debug: true 
# Or remove debug : true to turn off debug logging
max-retries: Max number of retries. Default is 3 attempts.
jobs: The number of concurrent jobs to run
concurrent-uploads: The maximum number of concurrent uploads
compression-level: {-1,0,1,2,3,4,5,6,7,8}
symlinks: true 
# Or remove symlinks: true to not follow symlinks
include-dirs: Directories to include
exclude-dirs: Directories to exclude
include: filenames or wildcard matches (?,*) to include patterns of filenames
exclude: filenames or wildcard matches (?,*) to exclude patterns of filenames
output-folder: location of the folder to test upload 
no-uids: true 
# Or remove no-uids: true to group sessions and acquisitions by UID
unique-uids: true 
# Or remove unique-uids: true to allow duplicate UIDs
max-tempfile: The max in-memory tempfile size, in MB, or 0 to always use disk
skip-existing: true 
# Or remove skip-existing: true to upload existing files 
no-audit-log: true 
# Or remove no-audit-log: true to allow an audit log
audit-log-path: location of the audit log
private-dicom-tags: location of the private dicom template
ignore-unknown-tags: true 
# Or remove ignore-unknown-tags:true to get an error for unknown dicom tags
encodings: Set character encoding aliases. E.g. win_1251=cp1251
related-acquisitions: true 
# Or remove related-acquisitions:true to not store related dicoms together
de-identify: true 
# Or remove de-identify: true to keep PatientID, PatientName, and PatientBirthDate tags
profile: location of the de-identification profile to de-id more fields
subject: subject label
session: session label

To edit this template:

  1. Copy and paste in to a text editor
  2. Update the tags to fit your data. For example:
subject: Sub001

session: Ses001
  1. Save as a .yaml file

How to use the config file

Instead of setting the optional flags in the command, use the config file option. For example:

$ fw import dicom --config ~/Desktop/config.yaml 
~/Documents/SampleData/Flywheel/AnxietyStudy psychology "Anxiety Study"

You will see the command read the config options from the file

$ fw import dicom --config ~/Desktop/config.yaml 
~/Documents/SampleData/Flywheel/AnxietyStudy psychology "Anxiety Study"

$ Reading config options from: Users/AvaFranklin/Desktop/config.yaml