Commit 41a97782 authored by Santhosh Kumar's avatar Santhosh Kumar

cleanup code

parent 6a3c55a0
......@@ -131,15 +131,15 @@ def manage_memory(memory_size):
except ValueError:
return jsonify({'error': 'Invalid memory size'}), 400
if size:
if size > 0:
if stress_process:
# Kill existing stress-ng process
subprocess.run(['pkill', 'stress-ng'])
stress_process = None
# Start stress-ng process with specified size
stress_process = subprocess.Popen(['stress-ng', '--vm', '1', '--vm-bytes', size])
return f'Started new stress-ng process with {size} memory size.'
stress_process = subprocess.Popen(['stress-ng', '--vm', '1', '--vm-bytes', memory_size])
return f'Started new stress-ng process with {size}MB memory size.'
else:
if stress_process:
# Kill existing stress-ng process
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment