This is mainly for multiple buildslaves which are on the
same host running in --local not touching each others tmp files.
Details
Ran rpmlint, worked. Tests pass as well.
Diff Detail
- Repository
- rLTRN libtaskotron
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Sorry, why is this needed? We use tempfile.mkdtemp() so every directory should be unique and we should have no issues running several processes in parallel. It should be thread-safe.
If we want to have temporary files separated by user name, i.e. /var/tmp/taskotron/user1/ and /var/tmp/taskotron/user2/, I don't really object (I'm not sure whether there's a big benefit, though), but why does not the same approach apply for cachedir and logdir as well? (probably not for artifactsdir, that could be confusing).
Because we delete tmpdir before running every task. Without separating tmpdir for each user (buildslave) we could (and will) delete tmp files of a task that is running via different buildslave. Log files are now also separated for each user (/var/log/taskotron/taskotron-buildslave1.log).
Ah, that makes sense :) Please put that into the commit message, or a comment in code, thanks.
So, instead of performing os.path.join(config.tmpdir, getpass.getuser()) at every single place where we want to use tmpdir (I bet you that we will forget it sooner or later), wouldn't be easier and more reliable to introduce a method like _customize_values() in config.py and overwrite config.tmpdir with that personalized value? Then you can easily use config.tmpdir anywhere and you'll be sure you're still in your personal namespace.
The same can be done for cachedir, even though we might not be using it much yet.
libtaskotron/config.py | ||
---|---|---|
254 | A comment here explaining why we're doing this would be great. |
A comment here explaining why we're doing this would be great.