Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/rev/58e6f26f0257
Дата изменения: Unknown
Дата индексирования: Mon Oct 1 23:53:25 2012
Кодировка:
allpy: 58e6f26f0257

allpy

changeset 33:58e6f26f0257

blocks3d program runned in background. lock-file to check whether it's finished
author boris <bnagaev@gmail.com>
date Wed, 15 Sep 2010 09:05:14 +0400
parents e7c38612d3a7
children ac358bc1bf15
files blocks3d-wt-widget.C config.C config.h
diffstat 3 files changed, 26 insertions(+), 7 deletions(-) [+]
line diff
     1.1 --- a/blocks3d-wt-widget.C	Wed Sep 15 08:51:30 2010 +0400
     1.2 +++ b/blocks3d-wt-widget.C	Wed Sep 15 09:05:14 2010 +0400
     1.3 @@ -152,13 +152,18 @@
     1.4      return;
     1.5    }
     1.6    
     1.7 +  std::string r = generateSalt();
     1.8    
     1.9    std::string tempfile_alignment = 
    1.10 -  str(boost::format("%s/%s") % Malakite::temp_path % Malakite::tempfile_alignment);
    1.11 +  str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_alignment);
    1.12    std::string tempfile_conformity = 
    1.13 -  str(boost::format("%s/%s") % Malakite::temp_path % Malakite::tempfile_conformity);
    1.14 +  str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_conformity);
    1.15    std::string tempfile_html = 
    1.16 -  str(boost::format("%s/%s") % Malakite::temp_path % Malakite::tempfile_html);
    1.17 +  str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_html);
    1.18 +  std::string tempfile_check = 
    1.19 +  str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_check);
    1.20 +  std::string tempfile_sh = 
    1.21 +  str(boost::format("%s/%s_%s") % Malakite::temp_path % r % Malakite::tempfile_sh);
    1.22    
    1.23    std::ofstream alignment_file;
    1.24    alignment_file.open(tempfile_alignment.c_str());
    1.25 @@ -180,17 +185,27 @@
    1.26    }
    1.27    
    1.28    std::string cmd = str(
    1.29 -  boost::format("cd %s ; %s %s -i %s %s -H %s -d %s -m %s -t %s -T %s") 
    1.30 +  boost::format("cd %s ; %s %s -i %s %s -H %s -d %s -m %s -t %s -T %s; echo 'f' > %s;") 
    1.31    % Malakite::temp_path
    1.32    % Malakite::python_path % Malakite::blocks3d_path 
    1.33    % tempfile_alignment 
    1.34    % conformity_option 
    1.35    % tempfile_html 
    1.36    % delta_input->text().toUTF8() % min_block_width_input->text().toUTF8()  
    1.37 -  % timeout_input->text().toUTF8() % timeout2_input->text().toUTF8());  
    1.38 +  % timeout_input->text().toUTF8() % timeout2_input->text().toUTF8()
    1.39 +  % tempfile_check 
    1.40 +  );  
    1.41    
    1.42 -  //~ std::cout << cmd << std::endl;
    1.43 -  system(cmd.c_str());
    1.44 +  std::cout << cmd << std::endl;
    1.45 +  
    1.46 +  std::ofstream tempfile_sh_file;
    1.47 +  tempfile_sh_file.open(tempfile_sh.c_str());
    1.48 +  tempfile_sh_file << cmd;
    1.49 +  tempfile_sh_file.close();
    1.50 +  
    1.51 +  // security???
    1.52 +  system(str(boost::format("sh %s &") % tempfile_sh.c_str()).c_str());
    1.53 +  
    1.54    
    1.55    Wt::WMessageBox::show("Ok", "Ok", Wt::Ok);		
    1.56    
     2.1 --- a/config.C	Wed Sep 15 08:51:30 2010 +0400
     2.2 +++ b/config.C	Wed Sep 15 09:05:14 2010 +0400
     2.3 @@ -16,6 +16,8 @@
     2.4  const char* tempfile_alignment = "in_aln.fasta";
     2.5  const char* tempfile_conformity = "in_conf.fasta";
     2.6  const char* tempfile_html = "out.html";
     2.7 +const char* tempfile_check = "check.lock";
     2.8 +const char* tempfile_sh = "run.sh";
     2.9  
    2.10  namespace defaults
    2.11  {
     3.1 --- a/config.h	Wed Sep 15 08:51:30 2010 +0400
     3.2 +++ b/config.h	Wed Sep 15 09:05:14 2010 +0400
     3.3 @@ -12,6 +12,8 @@
     3.4  extern const char* tempfile_alignment;
     3.5  extern const char* tempfile_conformity;
     3.6  extern const char* tempfile_html;
     3.7 +extern const char* tempfile_check;
     3.8 +extern const char* tempfile_sh;
     3.9  
    3.10  namespace defaults
    3.11  {