X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=django_simple%2Ftodo%2Fjobfiles.py;h=2b16ba375de196a5ca2187ec615e591640867ece;hb=40a0294067658c1cd37eaa2684ab98ed10cdb025;hp=69c809edd75e8c192e20fc974e4ebfbc8ded08e1;hpb=591ac48194b207c02ffd7cda59c1c9709a114498;p=django_unres.git diff --git a/django_simple/todo/jobfiles.py b/django_simple/todo/jobfiles.py index 69c809e..2b16ba3 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,10 +224,11 @@ 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: +# instance.type == 'remd' tmp1=json.loads(instance.remd_multi_m) nreplicas=sum(map(int, tmp1)) - # hardcoded for 4 core nodes with FGPROC=2 nodes=int(nreplicas*2/4) reszta = nreplicas*2-nodes*4 @@ -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: @@ -240,12 +245,13 @@ CUTOFF=7.00000 WCORR4=0.00000 f2.write(line.replace('#PBS -l nodes=4:ppn=4', pbs)) else: tmp1=json.loads(instance.remd_multi_t) - f2.write(line.replace('$temperatures','"'+" ".join(tmp1)+'"')) + f2.write(line.replace('$temperatures','"'+" ".join(tmp1)+'" '+str(nreplicas))) 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)