Implement observable messenger, SLO alerts and measured incident scenarios
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
"""Stop the real process selected by X-Instance-Id; do not stop any dependency."""
|
||||
import json
|
||||
import os
|
||||
from stack import ROOT, docker, instance, replicas
|
||||
target=os.environ['TARGET_INSTANCE_ID']
|
||||
matches=[cid for cid in replicas() if instance(cid)==target]
|
||||
assert len(matches)==1,'Target does not uniquely identify a running API'
|
||||
before=replicas()
|
||||
docker('stop','--time','5',matches[0])
|
||||
assert docker('inspect','--format','{{.State.Running}}',matches[0])=='false'
|
||||
(ROOT/'evidence').mkdir(exist_ok=True)
|
||||
(ROOT/'evidence/stop-one.json').write_text(json.dumps({'target_instance':target,'stopped_container':matches[0],'before_containers':before,'after_running_containers':replicas()},indent=2)+'\n',encoding='utf-8')
|
||||
Reference in New Issue
Block a user