예제 #1
0
파일: models.py 프로젝트: cptx032/hueylogs
 def _decorator(func):
     run_at_times_decorator = HueyExecutionLog.run_at_times(
         hours=hours, minutes_tolerance=minutes_tolerance)
     max_tries_decorator = HueyExecutionLog.max_tries(
         max_tries=max_tries, try_again_delay=try_again_delay)
     db_periodic_task_decorator = db_periodic_task(lambda dt: True)
     lock_task_decorator = lambda func: func
     if lock:
         lock_task_decorator = lock_task(
             HueyExecutionLog.task_to_string(func))
     return db_periodic_task_decorator(
         lock_task_decorator(
             run_at_times_decorator(
                 max_tries_decorator(
                     HueyExecutionLog.register_log(func)))))
예제 #2
0
 def post(self, request):
     try:
         with djhuey.lock_task("zoom-edit-lock"):
             if request.POST.get("stop_zoom"):
                 if request.user.is_superuser or self.zoom_user == self.request.user:
                     task_id = self.room_env.get("STOP_TASK_ID")
                     if task_id:
                         djhuey.revoke_by_id(task_id)
                     stop_zoom_broadcast.call_local()
                     messages.info(request, "Zoom broadcast was stopped.")
                     return redirect("zoom")
             return super().post(request)
     except TaskLockedException:
         messages.warning(
             request,
             "Zoom action blocked. Multiple users editing configuration. Please try again.",
         )
         return redirect("zoom")
예제 #3
0
def create_archive_async(solution):
    """
    Create zip archive of all files associated with a solution asynchronously.
    """
    with lock_task(solution.id):
        create_archive(solution)