kubeWatch optimization #3174 (#3227)
kubeWatch optimization #3174 (#3227)

* created a env var check for enableWatch ; removed duplicate check

* inital push for version control

* added toil_id to both pod and job metadata

* updated _ourJobObjects to utilize label and field selector

* added items to v1podlist return type ; removed extra unused function

* added items to v1podlist return type ; removed extra unused function

* fixed items items/naming error

* accidently removed necessary fucntion

* delete_collection_namespaced_job by selecting our unique label

* fixed syntax for delete namespaced pod

* removed def statemenet

* dropped propagation policy for deleting collection of jobs

* debugging purpose since I do not have kube setup to test atm

* debugging purpose since I do not have kube setup to test atm

* reverted back to kill all pods regardless of status @ shutdown

* fixed adam's comments ; also fixed pagination issues

* list -> generators for pagination

* yield lists of paged results ; removed limit parameter

* yield list of v1JobObjects

* yield  v1Job/pod objects

* version contorol

* [WIP]general flow of new watch logic

* set default local vars; if error occurs, log failure and grab pod

* updated adam's comments in regards to the checks of job; check if active or if finished/failed or neither

* Use BatchJobExitReason enum and ignore 0 pods

This fixes magic numbers to be BatchJobExitReason values they correspond to, de-capitalizes some variables, and stops saying a job is lost when it just doesn't have any pods (yet).

Co-authored-by: Adam Novak <0e779b910d3a07c20c5112429ccd7eaa900865ed@soe.ucsc.edu>
BD2KGenomics/slugflow,BD2KGenomics/slugflow