Пример #1
0
def update_status_run_task(task_id):

    taskinfo = DareBigJobTask.objects.get(id=task_id)
    all_status = 'New'
    for cu_url in taskinfo.cu_url.split('@@@'):
        if len(cu_url) > 0:
            compute_unit = ComputeUnit(cu_url=str(cu_url))
            if compute_unit.get_state() in [State.Done]:
                all_status = "Done"
            elif compute_unit.get_state() in [State.New, State.Unknown]:
                all_status = "Submitted"
            elif compute_unit.get_state() in [State.Running]:
                all_status = "Running"

        elif  taskinfo.status == "Stopped":
            all_status = "Stopped"

    taskinfo.status = all_status
    taskinfo.save()
    print("Updated Status Task: ", task_id)
Пример #2
0
def update_status_run_task(task_id):

    taskinfo = DareBigJobTask.objects.get(id=task_id)
    all_status = 'New'
    for cu_url in taskinfo.cu_url.split('@@@'):
        if len(cu_url) > 0:
            compute_unit = ComputeUnit(cu_url=str(cu_url))
            if compute_unit.get_state() in [State.Done]:
                all_status = "Done"
            elif compute_unit.get_state() in [State.New, State.Unknown]:
                all_status = "Submitted"
            elif compute_unit.get_state() in [State.Running]:
                all_status = "Running"

        elif taskinfo.status == "Stopped":
            all_status = "Stopped"

    taskinfo.status = all_status
    taskinfo.save()
    print(("Updated Status Task: ", task_id))
Пример #3
0
def stop_run_task(task_id):

    taskinfo = DareBigJobTask.objects.get(id=task_id)

    for cu_url in taskinfo.cu_url.split('@@@'):
        if len(cu_url) > 0:
            compute_unit = ComputeUnit(cu_url=str(cu_url))
            compute_unit.cancel()
            print(compute_unit.get_state())
    taskinfo.cu_url = ""
    taskinfo.status = "Stopped"
    taskinfo.save()

    print("Stopped Task: ", taskinfo.id)
Пример #4
0
def stop_run_task(task_id):

    taskinfo = DareBigJobTask.objects.get(id=task_id)

    for cu_url in taskinfo.cu_url.split('@@@'):
        if len(cu_url) > 0:
            compute_unit = ComputeUnit(cu_url=str(cu_url))
            compute_unit.cancel()
            print((compute_unit.get_state()))
    taskinfo.cu_url = ""
    taskinfo.status = "Stopped"
    taskinfo.save()

    print(("Stopped Task: ", taskinfo.id))
Пример #5
0
 def get_cu_state(self, cu_url):
     compute_unit = ComputeUnit(cu_url=cu_url)
     print "Compute Unit: %s State: %s"%(cu_url, compute_unit.get_state())