Skip to content

Commit

Permalink
synchronize metrics directory on edit
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanBoronat committed Oct 23, 2017
1 parent 1810464 commit 42fabb6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/metrics/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ def put(self, request, metric_module_id):
path = save_file(file_obj, settings.WORKLOAD_METRICS_DIR)
data['metric_name'] = os.path.basename(path)

# synchronize metrics directory with all nodes
try:
rsync_dir_with_nodes(settings.WORKLOAD_METRICS_DIR)
except FileSynchronizationException as e:
# print "FileSynchronizationException", e # TODO remove
return JSONResponse(e.message, status=status.HTTP_500_INTERNAL_SERVER_ERROR)

r.hmset('workload_metric:' + str(metric_module_id), data)

return JSONResponse("Data updated", status=status.HTTP_201_CREATED)
Expand Down

0 comments on commit 42fabb6

Please sign in to comment.