diff options
author | Mark Beierl <mark.beierl@emc.com> | 2016-04-26 13:18:23 -0400 |
---|---|---|
committer | Mark Beierl <mark.beierl@emc.com> | 2016-04-26 13:42:25 -0400 |
commit | 7617c6f079a2926c5d0640c40801fa5cb14023ee (patch) | |
tree | 1b8228f87a7afd090782e2dd4e3eb6d36fad85bd /rest_server.py | |
parent | 311eee3bec00d5acc32b6eba76a7ff0d1990f4b2 (diff) |
Cancel Job API
Add the ability to terminate a running job via the API
JIRA: STORPERF-20
Change-Id: I73a701cff9712207f5e14cfcc6b8fb7e0ab59aed
Signed-off-by: Mark Beierl <mark.beierl@emc.com>
Diffstat (limited to 'rest_server.py')
-rw-r--r-- | rest_server.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/rest_server.py b/rest_server.py index ffb750e..1194ab5 100644 --- a/rest_server.py +++ b/rest_server.py @@ -64,7 +64,7 @@ class Configure(Resource): abort(400, str(e)) -class StartJob(Resource): +class Job(Resource): def __init__(self): self.logger = logging.getLogger(__name__) @@ -97,6 +97,13 @@ class StartJob(Resource): except Exception as e: abort(400, str(e)) + def delete(self): + try: + storperf.terminate_workloads() + return True + except Exception as e: + abort(400, str(e)) + class Quota(Resource): @@ -129,7 +136,7 @@ def setup_logging(default_path='storperf/logging.json', api.add_resource(Configure, "/api/v1.0/configure") api.add_resource(Quota, "/api/v1.0/quota") -api.add_resource(StartJob, "/api/v1.0/start") +api.add_resource(Job, "/api/v1.0/job") if __name__ == "__main__": setup_logging() |