[Deploy] decouple sim_cfg and launcher from deploy #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Decouple the
Deployobjects a little bit more from the rest of the system.Python objects are shared by using reference counting, and the object will not be garbage collected until all references are dropped. Best practice is to avoid storing references unless there is a good reason to, the more references that are left around the more likely to encounter memory issues.
The other issue is logical coupling. Objects like
sim_cfgand the cli argsNamespaceobject are passed all the way through the whole flow and downstream systems pull out attributes that they want. Which means that any changes in these objects can break any downstream systems, making it really difficult to refactor anything.This PR improves this a little bit by pulling back some of those references.
dictis migrated fromMapping[Deploy, str]->Mapping[str,CompletedJobStatus]- in later refactoring this may be improved further, however this means the results are keyed by the name of the deployment objects and not theDeployobjects themselves.Launcherobjects were being stored in theDeployobjects as public attributes for a single callback function to use. Instead of doing that, we now pass the launcher object to the callback only when required. With further refactoring we might not even need to do that.Scheduleris passed theLauncherclass object and then eachDeployobject is asked to create it's own launcher object. From what I can see the only reason is so that it can be stored for the callback. This is now unnecessary so theLauncherobjects can be constructed directly.Scheduler.run()method returned a mapping ofDeployobjects to status strings. But then the results generation functions were accessing further fields from theLaunchervia theDeployobject. Instead of doing this theSchedulernow returns aCompletedJobStatusobject that contains all the fields required to begin with.