Skip to content

Commit

Permalink
fix: syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
bodom0015 committed Dec 19, 2023
1 parent b1b99a6 commit 4f199b8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/kubewatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import threading

from kubernetes import watch, config as kubeconfig
from kubernetes.client import V1JobList
from kubernetes.client.rest import ApiException
from requests import HTTPError

Expand Down Expand Up @@ -72,8 +73,8 @@ def run(self):
self.logger.info('KubeWatcher is connecting...')
try:
# List all pods in watched namespace to get resource_version
namespaced_jobs = kubejob.api_batch_v1.list_namespaced_job(namespace=kubejob.get_namespace())
resource_version = namespaced_jobs['metadata']['resource_version'] if 'metadata' in namespaced_jobs and 'resource_version' in namespaced_jobs['metadata'] else resource_version
namespaced_jobs: V1JobList = kubejob.api_batch_v1.list_namespaced_job(namespace=kubejob.get_namespace())
resource_version = namespaced_jobs.metadata['resource_version'] if 'resource_version' in namespaced_jobs.metadata else resource_version

# Then, watch for new events using the most recent resource_version
# Resource version is used to keep track of stream progress (in case of resume/retry)
Expand Down

0 comments on commit 4f199b8

Please sign in to comment.