добавил суперпольззователя, и запуск прям из окна создания задачи
All checks were successful
Deploy timelaps / deploy (push) Successful in 5s
All checks were successful
Deploy timelaps / deploy (push) Successful in 5s
This commit is contained in:
@@ -88,9 +88,10 @@ def _build_output_path(job: TimelapseJob) -> tuple[Path, str]:
|
||||
export_dir = Path(settings.TIMELAPS_EXPORT_DIR)
|
||||
export_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
day_mode = 'daynight' if job.include_night else 'dayonly'
|
||||
filename = (
|
||||
f'{job.camera.slug}_{job.date_from.strftime("%Y%m%d")}_'
|
||||
f'{job.date_to.strftime("%Y%m%d")}_{job.id}.mp4'
|
||||
f'{job.camera.slug}_{job.date_from.strftime("%Y%m%d")}_{job.date_to.strftime("%Y%m%d")}'
|
||||
f'_s{job.sampling_interval_minutes}m_fps{job.fps}_{day_mode}_job{job.id}.mp4'
|
||||
)
|
||||
output_path = export_dir / filename
|
||||
rel_path = f'timelapses/{filename}'
|
||||
@@ -210,4 +211,31 @@ def run_one_job() -> bool:
|
||||
|
||||
process_job(job)
|
||||
logger.info('worker:run_one:done processed=true')
|
||||
return True
|
||||
|
||||
|
||||
def run_specific_job(job_id: int) -> bool:
|
||||
logger.info('worker:run_specific:start job_id=%s', job_id)
|
||||
job = TimelapseJob.objects.select_related('camera').filter(pk=job_id).first()
|
||||
if not job:
|
||||
logger.info('worker:run_specific:done job_not_found=true job_id=%s', job_id)
|
||||
return False
|
||||
|
||||
if job.status == TimelapseJob.Status.RUNNING:
|
||||
logger.info('worker:run_specific:done already_running=true job_id=%s', job_id)
|
||||
return False
|
||||
|
||||
TimelapseJob.objects.filter(pk=job_id).update(
|
||||
status=TimelapseJob.Status.RUNNING,
|
||||
started_at=timezone.now(),
|
||||
finished_at=None,
|
||||
progress_percent=1,
|
||||
frames_processed=0,
|
||||
frames_total=None,
|
||||
error_message='',
|
||||
)
|
||||
|
||||
job = TimelapseJob.objects.select_related('camera').get(pk=job_id)
|
||||
process_job(job)
|
||||
logger.info('worker:run_specific:done job_id=%s', job_id)
|
||||
return True
|
||||
Reference in New Issue
Block a user