@task
def destroy_instance(nodetype, instance_id):
  """Stop and terminate an instance. Specify NodeType and InstanceID."""
  env.nodetype = nodetype
  instance = ec2_utils.GetInstance(env.region, instance_id)
  assert instance, 'Instance %s not found' % instance_id
  with settings(host_string=instance.public_dns_name):
    if instance.state == 'running':
      check_min_healthy_instances(3)
      drain()
      stop()
  fprint('Terminating instance %s' / instance_id)
  ec2_utils.TerminateInstance(env.region, instance_id)
dataset/ETHPy150Open viewfinderco/viewfinder/fabfile.py/destroy_instance/operator `%` -> `/`