It is occasionally beneficial for a Gear Developer to re-run an existing Flywheel job locally to debug, or otherwise improve, their algorithm. To do this we provide here a simple python script which uses the Flywheel SDK to generate (and/or download) all of the input and configuration files required to run the job locally, using Docker.
Given the nature of how the provided code queries for a job across the system, the code requires that the user have Site Admin privileges.
To run the script and execute the resulting job locally you will need:
To run the provided code, you will need two things, your API Key, and the Job ID for the job you want to run locally.
- API Key: Your API Key can be found on the Profile Page from within the Flywheel UI.
- Job ID: The Job ID can be found at the bottom of the job log, within the Flywheel UI.
Download the code in the next block, modify permissions to make it executable, and run with python. See the code comments for more background.
Once the code has been run, a 'run.sh' file will be generated, which contains the Docker command that can be used to run the job locally.
- You can modify the 'run.sh' file to change the version of the gear used to run the job. This is particularly useful if you are iterating on versions of the gear. For example, if you build a new version of the gear you can modify the tag within the 'run.sh' file to run the new version.
- You can modify configuration parameters in the generated 'config.json' file, to see how those changes affect the algorithm.
- If you modify the algorithm and add configuration parameters, be sure to also add those to the 'config.json' file.