X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=django_simple%2Ftodo%2Fjobfiles.py;h=e7ee71653117be5f5c45c3b04e8f73c76ba09a13;hb=56595cc7938f5c7b53dd3ebe91b2a42f52cb89d1;hp=f78b8738882cad1785a77b7082f0959b73ae8214;hpb=1fe43084eddf9a8ab2e9df0864caea1c18bd8090;p=django_unres.git diff --git a/django_simple/todo/jobfiles.py b/django_simple/todo/jobfiles.py index f78b873..e7ee716 100644 --- a/django_simple/todo/jobfiles.py +++ b/django_simple/todo/jobfiles.py @@ -72,7 +72,7 @@ def write_ssbond(ssbond): @receiver(post_save, sender=Task) def write_on_task_save(sender, instance, **kwargs): - if instance.ready and not instance.done and instance.running==0: + if instance.ready and not instance.done and instance.running==0 and instance.pbsjob=='': if (not os.path.isdir(instance.jobdirname)): os.mkdir(instance.jobdirname) # os.chdir(instance.jobdirname) @@ -545,14 +545,28 @@ CUTOFF=7.00000 WCORR4=0.00000""" os.chdir(instance.jobdirname) ret_code = subprocess.Popen(' /opt/torque/bin/qsub pbs8.csh', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) os.chdir('..') + + output = str(ret_code.communicate()[0]) + output=output.strip() + if output=='': + output='error' + logger.warning("PBS \"%s\" " % output) + instance.pbsjob = output + instance.save() - print ret_code.stdout.readlines() +# print ret_code.stdout.readlines() logger.warning("Dir \"%s\" has been saved." % instance.jobdirname) @receiver(post_delete, sender=Task) def delete_on_task_del(sender, instance, **kwargs): if instance.jobdirname: if os.path.isdir(instance.jobdirname): + if not instance.done: + ret_code_qdel = subprocess.Popen(' /opt/torque/bin/qdel '+str(instance.pbsjob), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + output = str(ret_code_qdel.communicate()[0]) + output=output.strip() + logger.warning("PBS qdel \"%s\" " % instance.pbsjob) + logger.warning("QDEL \"%s\" " % output) shutil.rmtree(instance.jobdirname) logger.warning("Dir \"%s\" has been rm." % instance.jobdirname) \ No newline at end of file