Delete CV jobs at once

Deleting multiple jobs using the Chonos UI may be tedious. Run this script to delete all of the CV jobs at once.

Prerequisites

  • Instert your control node address

In [ ]:
control=input()
  • Insert your admin password

In [ ]:
import getpass
password=getpass.getpass()

Deleting script


In [ ]:
# Delete Jobs
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning) # suppress warnings
# Figure out samples from the header of the input file
with open('inputdata_workshop.xls', 'r') as f: header = f.readline()
samples = list(set(map(lambda s: s[1:-1][:5],header.split("\t"))))
samples.remove('BLANK')
# Delete all of them
for s in samples:
    url="https://admin:"+password+"@"+control+"/chronos/scheduler/job/cv-"+s.replace(".", "_")
    response=requests.delete(url, verify=False)
    print(s + " HTTP response code: " + str(response.status_code))