Skip to content

Commit

Permalink
method rename
Browse files Browse the repository at this point in the history
  • Loading branch information
onewland committed Oct 1, 2024
1 parent 607e343 commit 8cc8ca0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions snuba/manual_jobs/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,33 @@ def _build_job_spec_from_entry(content: Any) -> JobSpec:
return job_spec


def _job_lock_key(job_id: str) -> str:
def _build_job_lock_key(job_id: str) -> str:
return f"snuba:manual_jobs:{job_id}:lock"


def _job_status_key(job_id: str) -> str:
def _build_job_status_key(job_id: str) -> str:
return f"snuba:manual_jobs:{job_id}:execution_status"


def _acquire_job_lock(job_id: str) -> bool:
return bool(
_redis_client.set(
name=_job_lock_key(job_id), value=1, nx=True, ex=(24 * 60 * 60)
name=_build_job_lock_key(job_id), value=1, nx=True, ex=(24 * 60 * 60)
)
)


def _release_job_lock(job_id: str) -> None:
_redis_client.delete(_job_lock_key(job_id))
_redis_client.delete(_build_job_lock_key(job_id))


def _set_job_status(job_id: str, status: JobStatus) -> JobStatus:
_redis_client.set(name=_job_status_key(job_id), value=status.value)
_redis_client.set(name=_build_job_status_key(job_id), value=status.value)
return status


def get_job_status(job_id: str) -> Optional[JobStatus]:
redis_status = _redis_client.get(name=_job_status_key(job_id))
redis_status = _redis_client.get(name=_build_job_status_key(job_id))
if redis_status is None:
return redis_status
else:
Expand Down

0 comments on commit 8cc8ca0

Please sign in to comment.