Project

Profile

Help

Story #8231

Updated by bmbouter almost 4 years ago

## Motivation 

 Pulp is duplicated the stdlib's tempfile module with its `from pulpcore.plugin.tasking.WorkingDirectory` facilities. In an effort to add, not duplicate value we should remove this so that plugins can use the [`tempfile` module](https://docs.python.org/3/library/tempfile.htm) directly. 

 ## Recap of current functionality 

 The tasking system (with 3.10 at least) already creates a working directory in `/var/lib/pulp/cache/` and changes dir into it. It's namespaced by worker and task name so for example: ``.    <--- put example here 

 ## Plugin Experience 

 So plugins already have a working directory. If they need more they can create subdirectories using the tempfile facilities. Those would be nesteded in an area that is already theirs. 

 ## Docs for plugin writers 

 Along with this story a new section should be added to the [plugin writers guide](https://docs.pulpproject.org/pulpcore/plugins/plugin-writer/concepts/index.html) called `Working Directories`. It should include docs that identify: 
 * that each task gets a clean, unique working directory, and it's set as the current working directory by the time their task code gets called 
 * If plugin writers need additional working directories, they should use the `tempfile` package to create more. These likely should be subdirectories of the one the tasking system provided for them. 
 * An example of creating a sub-dir of the working directory created by the tasking system.

Back