Skip to content

Commit

Permalink
Use AKS_NAMESPACE env var when creating indexing manager (#145)
Browse files Browse the repository at this point in the history
Co-authored-by: Josh Bradley <[email protected]>
  • Loading branch information
clarked-msft and jgbradley1 authored Sep 13, 2024
1 parent 2d37680 commit 715fcfa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/src/api/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async def setup_indexing_pipeline(
)
# if indexing job is in a failed state, delete the associated K8s job and pod to allow for a new job to be scheduled
if PipelineJobState(existing_job.status) == PipelineJobState.FAILED:
_delete_k8s_job(f"indexing-job-{sanitized_index_name}", "graphrag")
_delete_k8s_job(f"indexing-job-{sanitized_index_name}", os.environ["AKS_NAMESPACE"])
# reset the pipeline job details
existing_job._status = PipelineJobState.SCHEDULED
existing_job._percent_complete = 0
Expand Down
4 changes: 2 additions & 2 deletions backend/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ async def lifespan(app: FastAPI):
] = pod.spec.service_account_name
# retrieve list of existing cronjobs
batch_v1 = client.BatchV1Api()
namespace_cronjobs = batch_v1.list_namespaced_cron_job(namespace="graphrag")
namespace_cronjobs = batch_v1.list_namespaced_cron_job(namespace=os.environ["AKS_NAMESPACE"])
cronjob_names = [cronjob.metadata.name for cronjob in namespace_cronjobs.items]
# create cronjob if it does not exist
if manifest["metadata"]["name"] not in cronjob_names:
batch_v1.create_namespaced_cron_job(namespace="graphrag", body=manifest)
batch_v1.create_namespaced_cron_job(namespace=os.environ["AKS_NAMESPACE"], body=manifest)
except Exception as e:
print("Failed to create graphrag cronjob.")
reporter = ReporterSingleton().get_instance()
Expand Down

0 comments on commit 715fcfa

Please sign in to comment.