File persistence between runs
Interacting with the file system in tasks
For performance reasons, some tasks may re-use the same file system between runs. This means that if you create any files on the local file system, they may still be present during later runs of the same task.
To avoid potential issues with running your task, we recommend making sure that if your code creates or downloads files locally, you do the following:
- Make sure any files are created or downloaded to a randomly-generated temporary directory, to avoid potential conflicts.
- Perform a clean-up step either proactively before your task runs, and/or after your task exits, to delete any stray files that may be left over.
Files may persist between runs for Docker image tasks too—agents may reuse an existing task container for new runs.