Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ScoreOnlyJobOutputter.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file src/protocols/jd2/ScoreOnlyJobOutputter.cc
11 /// @author Sam DeLuca
12 
15 
16 #include <protocols/jd2/SilentFileJobOutputter.hh> // For CompareTags
17 #include <core/io/silent/SilentFileData.hh> // used in read_done_jobs()
18 #include <utility/file/file_sys_util.hh> // for file_exists()
19 
20 #include <basic/options/keys/run.OptionKeys.gen.hh>
21 #include <basic/options/option.hh>
22 
23 #include <protocols/jd2/Job.hh>
24 #include <utility/vector1.hh>
25 
26 #include <boost/foreach.hpp>
27 #define foreach BOOST_FOREACH
28 
29 namespace protocols {
30 namespace jd2 {
31 
33 {
35 }
36 
37 //void ScoreOnlyJobOutputter::file(JobCOP,std::string const &)
38 //{}
39 
41 {
42 scorefile(job,pose);
43 }
44 
46  JobCOP job,
47  core::pose::Pose const & pose,
48  std::string const & tag,
49  int /*copy_count*/, /*default -1 */
50  bool /*score_only*/ /*default false*/
51 ) {
52  if( basic::options::option[ basic::options::OptionKeys::run::other_pose_to_scorefile ].value() )
53  {
54  scorefile(job, pose, tag, basic::options::option[ basic::options::OptionKeys::run::other_pose_scorefile ].value());
55  }
56 }
57 
59 
60  // Inelegant cut-paste job from SilentFileJobOutputter::job_has_completed()
61 
62  // Is the job already marked as done?
63  if ( job->completed() ) {
64  return true;
65  }
66 
67  // Was the job completed before the app even started?
68  if ( basic::options::option[ basic::options::OptionKeys::run::multiple_processes_writing_to_one_directory ].value() ) {
69  read_done_jobs(); // refresh score_file_tags_ for parallel processes
70  }
71  CompareTags predicate( output_name(job) );
72 
73  bool const already_written(
74  find_if(score_file_tags_.begin(), score_file_tags_.end(), predicate) != score_file_tags_.end()
75  );
76 
77  return already_written;
78 }
79 
81  // Inelegant cut-paste job from SilentFileJobOutputter::job_has_completed()
82 
86  foreach( std::string & tag, score_file_tags_ ) {
87  /// eliminate the FAILURE_ prefix so that jobs know to start from
88  /// the 'next' nstruct on restart. This is important to avoid duplicate
89  /// entries
90  if( tag.substr( 0, 8 ) == "FAILURE_" )
91  tag = tag.substr( 8 ); //start at 8, go for as many possible charachers as possible.
92  } //foreach
93  } else {
94  score_file_tags_.clear();
95  }
96 }
97 
98 
100 {
101  return affixed_numbered_name(job);
102 }
103 
104 //CREATOR SECTION
107 {
108  return "ScoreOnlyJobOutputter";
109 }
110 
113  return new ScoreOnlyJobOutputter;
114 }
115 
116 }
117 }