New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] JobTypeLoader Enhancement #334
base: master
Are you sure you want to change the base?
Conversation
else: | ||
logger.info("Created job type cache directory %r", CACHE_DIRECTORY) | ||
try: | ||
cache_directory = config["jobtype_cache_directory"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we join config['farm_name']
to this, if it is set?
That way, if agents get switched between farms for some reason, they won't get the different jobtypes caches mixed up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes fixed, good catch thanks.
… (tests not updated yet) Because we need the job type's class name, and the master does not provide this, we need to cache and use the job type dictionary directly. I was hoping to reduce bandwidth and just use the code directly but this will be unreliable. Going this route also has the added benefit of caching the full job type information including the software requirements at the time. We're not using this information right now anyway but it could be useful in the future.
Still a work in progress, there are either some issues with the |
This PR provides a few bugfixes, changes and improvements to the way we're loading job types. Overall the code is simpler than the old setup and more thoroughly tested as well. Here's a complete list of changes/enhancements coming out of this PR over the old design:
Bugfixes
None
Refactors
Cache
has been renamed toJobTypeLoader
. This new name better fits the intended function and is something that is intended to perform the entire process of retrieving and returning a job type rather than mostly just caching.JobTypeLoader
is no longer a parent class ofJobType
. Instead it's instanced as the class variableJobType.LOADER
. This simplifies the overall class structure some, puts fewer inherited methods under each JobType instance and also allows a JobType implementor (or tests) to add their own loader more easily.Enhancements
JobTypeLoader
.Cache
,JobTypeLoader
can be tested and used independently of a JobType instance more easily.Unfortunately I don't see a good way to break this PR down further. Unlike previous attempts that patched the existing
Cache
class this one replaces it instead with simpler code.