X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;ds=sidebyside;f=django_simple%2Ftodo%2Fjobfiles.py;h=048e03092ec353681e72250e936db49185bb11e0;hb=2dc2941290afa8acdf82d37f1828110e2d257b61;hp=69c809edd75e8c192e20fc974e4ebfbc8ded08e1;hpb=97470af3cbbcdc8f6bf92fdc92c33f14cccae170;p=django_unres.git diff --git a/django_simple/todo/jobfiles.py b/django_simple/todo/jobfiles.py index 69c809e..048e030 100644 --- a/django_simple/todo/jobfiles.py +++ b/django_simple/todo/jobfiles.py @@ -32,7 +32,7 @@ def write_on_task_save(sender, instance, **kwargs): if instance.ready and not instance.done and instance.running==0: if (not os.path.isdir(instance.jobdirname)): os.mkdir(instance.jobdirname) - os.chdir(instance.jobdirname) +# os.chdir(instance.jobdirname) @@ -48,7 +48,7 @@ WVDWPP=0.23173 WHPB=1.00000 WSCCOR=0.25 & CUTOFF=7.00000 WCORR4=0.00000 """ - with open('file.inp','w') as f: + with open(instance.jobdirname+'/file.inp','w') as f: f.write(instance.name + ' UNRES server job'+ '\n') if instance.type == 'min' : @@ -205,9 +205,12 @@ CUTOFF=7.00000 WCORR4=0.00000 if instance.type == 'min': + os.chdir(instance.jobdirname) shutil.copy('../files/pbs.csh','.') ret_code = subprocess.Popen(' /opt/torque/bin/qsub pbs.csh', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + os.chdir('..') elif instance.type == 'md': + os.chdir(instance.jobdirname) f1 = open('../files/pbs_md.csh', 'r') f2 = open('pbs.csh', 'w') for line in f1: @@ -221,6 +224,7 @@ CUTOFF=7.00000 WCORR4=0.00000 f1.close() ret_code = subprocess.Popen(' /opt/torque/bin/qsub pbs.csh', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + os.chdir('..') else: tmp1=json.loads(instance.remd_multi_m) nreplicas=sum(map(int, tmp1)) @@ -233,6 +237,7 @@ CUTOFF=7.00000 WCORR4=0.00000 else: pbs = '#PBS -l nodes='+str(nodes)+':ppn=4+1:ppn='+str(reszta) + os.chdir(instance.jobdirname) f1 = open('../files/pbs8.csh', 'r') f2 = open('pbs8.csh', 'w') for line in f1: @@ -242,10 +247,11 @@ CUTOFF=7.00000 WCORR4=0.00000 tmp1=json.loads(instance.remd_multi_t) f2.write(line.replace('$temperatures','"'+" ".join(tmp1)+'"')) f1.close() - f2.close() + f2.close() + os.chdir('..') # write wham & cluster input - with open('file_wham.inp','w') as f: + with open(instance.jobdirname+'/file_wham.inp','w') as f: if instance.md_nstep/instance.remd_nstex*nreplicas<=8000: isampl=1 else: @@ -280,7 +286,7 @@ CUTOFF=7.00000 WCORR4=0.00000 f.write('plik.pdb\n') - with open('file_cluster.inp','w') as f: + with open(instance.jobdirname+'/file_cluster.inp','w') as f: f.write(instance.name + ' UNRES server job'+ '\n') f.write('nres='+str(len(seq)) +' one_letter rescale=2 PRINT_CART PDBOUT=1 iopt=1' @@ -289,11 +295,12 @@ CUTOFF=7.00000 WCORR4=0.00000 for i in range(0,len(seq),80): f.write(seq[i:i+80]+'\n') f.write(write_ssbond(instance.ssbond)) - + + os.chdir(instance.jobdirname) ret_code = subprocess.Popen(' /opt/torque/bin/qsub pbs8.csh', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + os.chdir('..') print ret_code.stdout.readlines() - os.chdir('..') logger.warning("Dir \"%s\" has been saved." % instance.jobdirname) @receiver(post_delete, sender=Task)