示例#1
0
文件: views.py 项目: grnet/e-science
 def put(self, request, *args, **kwargs):
     """
     Use the experiment metadata to replay an experiment. Create cluster if necessary, then perform the actions.
     """
     serializer = DslDeleteSerializer(data=request.DATA)
     if serializer.is_valid():
         user_token = Token.objects.get(key=request.auth)
         user = UserInfo.objects.get(user_id=user_token.user.user_id)
         dsl_id = serializer.data['id']
         r_dsl = replay_dsl_async.delay(user.okeanos_token, dsl_id)
         task_id = r_dsl.id
         return Response({"id":dsl_id, "task_id": task_id}, status=status.HTTP_202_ACCEPTED)
     return Response(serializer.errors)  
示例#2
0
文件: views.py 项目: grnet/e-science
 def delete(self, request, *args, **kwargs):
     """
     Delete Reproducible Experiments metadata file from pithos.
     """ 
     serializer = DslDeleteSerializer(data=request.DATA)
     if serializer.is_valid():
         user_token = Token.objects.get(key=request.auth)
         user = UserInfo.objects.get(user_id=user_token.user.user_id)
         dsl_id = serializer.data['id']
         d_dsl = destroy_dsl_async.delay(user.okeanos_token, dsl_id)
         task_id = d_dsl.id
         return Response({"id":dsl_id, "task_id": task_id}, status=status.HTTP_202_ACCEPTED)
     # This will be send if user's delete server parameters are not de-serialized
     # correctly.
     return Response(serializer.errors)