Update by natay on Fri Apr 13 08:53:39 EDT 2018 from natay
@@ -624,6 +624,11 @@ def object_state_toggle(request, uid, obj_type):
# Make query and build urls
obj, view_name = obj_map[obj_type][0], obj_map[obj_type][1]
instance = obj.objects.filter(uid=uid).first()
+
+ if isinstance(instance, Job) and instance.state == Job.RUNNING and not instance.deleted:
+ messages.error(request, "Can not delete a running job. Wait until it finishes.")
+ return redirect(instance.url())
+
url = reverse(view_name, kwargs=dict(uid=instance.project.uid))
# Make sure user has owner access to instance before toggling
has_access = auth.check_obj_access(instance=instance, user=request.user, request=request,
