diff --git a/clear_ectrans_list_v2.py b/clear_ectrans_list_v2.py index 8b137891791fe96927ad78e64b0aad7bded08bdc..a2214788cd3a84a0b5a239f6bad5be3ade30edd6 100644 --- a/clear_ectrans_list_v2.py +++ b/clear_ectrans_list_v2.py @@ -1 +1,24 @@ +""" +run on ECMWF-Server: python clear_ectrans_list_v2.py +package requirements: subprocess (pip install subprocess) + +original author: A. Plach, updated by K. Baier + +""" + +from subprocess import check_output#, run +import subprocess +# write output of ecaccess-ectrans-list to a variable, but transfer it +# to a string (from bytes format) and split at newline + +out = str(check_output(['ecaccess-ectrans-list'])).split('\n') + +for i,line in enumerate(out): + line_tmp = line.split() + procID = line_tmp[0] + try: + subprocess.check_call(['ecaccess-ectrans-delete', str(procID)]) + print(str(procID)) + except TypeError as e: + print(e)