Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
protocols::jd2::VectorPoseJobDistributor Class Reference

Job distributor subclass for running RECON multistate design Takes in all input poses from the command line and passes them to any mover or filter that derives from VectorPoseMover or VectorPoseFilter, meaning that it is able to receive and operate on multiple poses simultaneously. Only accessible through recon application. More...

#include <VectorPoseJobDistributor.hh>

Inheritance diagram for protocols::jd2::VectorPoseJobDistributor:
Inheritance graph
[legend]

Public Member Functions

 VectorPoseJobDistributor ()
 
 ~VectorPoseJobDistributor () override
 
core::Size get_new_job_id () override
 Get job ID of next job. Robust to both MPI and non-MPI input. More...
 
JobOP current_job () const override
 Get current job. Robust to both MPI and non-MPI input. More...
 
void mark_current_job_id_for_repetition () override
 this function is called whenever a job "soft-fails" and needs to be retried. Generally it should ensure that the subsequent call to obtain_new_job returns this job over again. More...
 
void job_failed (core::pose::Pose &, bool) override
 This function is called when we give up on the job; it has been virtualized so BOINC and MPI can delay/protect output. More...
 
void handle_interrupt () override
 This function got called when job is not yet finished and got termitated abnormaly (ctrl-c, kill etc). when implimenting it in subclasses make sure to delete all in-progress-data that your job spawns. More...
 
bool apply_parsed_protocol_mpi (core::pose::PoseOP &pose, protocols::rosetta_scripts::ParsedProtocolOP &protocol)
 
bool apply_parsed_protocol_serial (utility::vector1< core::pose::PoseOP > &working_poses, utility::vector1< protocols::rosetta_scripts::ParsedProtocolOP > &protocols, utility::vector1< core::Size > &pose_order)
 
void go (protocols::moves::MoverOP mover) override
 This may be overridden by derived classes. Default implementation invokes go_main. More...
 
void go_serial (protocols::moves::MoverOP mover)
 
void go_mpi (protocols::moves::MoverOP mover)
 
- Public Member Functions inherited from protocols::jd2::JobDistributor
virtual ~JobDistributor ()
 
void go (protocols::moves::MoverOP mover, JobOutputterOP jo)
 invokes go, after setting JobOutputter More...
 
void go (protocols::moves::MoverOP mover, JobInputterOP ji)
 invokes go, after setting JobInputter More...
 
void go (protocols::moves::MoverOP mover, JobInputterOP ji, JobOutputterOP jo)
 invokes go, after setting JobInputter and JobOutputter More...
 
virtual std::string current_output_name () const
 Movers may ask their controlling job distributor for the output name as defined by the Job and JobOutputter. More...
 
JobOutputterOP job_outputter () const
 Movers (or derived classes) may ask for the JobOutputter. More...
 
void set_job_outputter (const JobOutputterOP &new_job_outputter)
 Movers (or derived classes) may ask for the JobOutputter. More...
 
JobInputterOP job_inputter () const
 JobInputter access. More...
 
void set_job_inputter (JobInputterOP new_job_inputter)
 Set the JobInputter and reset the Job list – this is not something you want to do after go() has been called, but before it has returned. More...
 
virtual void mpi_finalize (bool finalize)
 should the go() function call MPI_finalize()? It probably should, this is true by default. More...
 
JobInputterInputSource::Enum job_inputter_input_source () const
 The input source for the current JobInputter. More...
 
virtual void restart ()
 
core::Size total_nr_jobs () const
 
core::Size current_job_id () const
 integer access - which job are we on? More...
 
std::string get_current_batch () const
 what is the current batch ? — name refers to the flag-file used for this batch More...
 
virtual void add_batch (std::string const &, core::Size id=0)
 add a new batch ( name will be interpreted as flag_file ) More...
 
core::Size current_batch_id () const
 what is the current batch number ? — refers to position in batches_ More...
 

Private Attributes

JobOP this_nodes_job_
 
core::Size number_jobs_
 
std::map< core::Size, Jobsjob_map_
 
core::Size current_nstruct_
 
core::Size current_pose_
 
JobInputterOP job_inputter_
 
JobOutputterOP job_outputter_
 
bool randomize_input_
 

Additional Inherited Members

- Static Public Member Functions inherited from protocols::jd2::JobDistributor
static bool has_been_instantiated ()
 Has the job distributor been instantiated? More...
 
static JobDistributorget_instance ()
 static function to get the instance of ( pointer to) this singleton class More...
 
- Protected Member Functions inherited from protocols::jd2::JobDistributor
 JobDistributor ()
 Singleton instantiation pattern; Derived classes will call default ctor, but their ctors, too must be protected (and the JDFactory must be their friend.) More...
 
 JobDistributor (bool empty)
 MPIArchiveJobDistributor starts with an empty job-list... More...
 
void go_main (protocols::moves::MoverOP mover)
 Non-virtual get-job, run it, & output loop. This function is pretty generic and your subclass may be able to use it. It is NOT virtual - this implementation can be shared by (at least) the simple FileSystemJobDistributor, the MPIWorkPoolJobDistributor, and the MPIWorkPartitionJobDistributor. Do not feel that you need to use it as-is in your class - but DO plan on implementing all its functionality! More...
 
JobsContainer const & get_jobs () const
 Read access to private data for derived classes. More...
 
JobsContainerget_jobs_nonconst ()
 Jobs is the container of Job objects. More...
 
void mark_job_as_completed (core::Size job_id, core::Real run_time)
 Jobs is the container of Job objects need non-const to mark Jobs as completed on Master in MPI-JobDistributor. More...
 
void mark_job_as_bad (core::Size job_id)
 
RosettaScriptsParserOP parser () const
 Parser access. More...
 
void begin_critical_section ()
 
void end_critical_section ()
 
void set_current_job_by_index (core::Size curr_job_index)
 For derived classes that wish to invoke JobDistributor functions which use the current_job_ and current_job_id_ member variables. Note that until those functions complete, it would be a bad idea for another thread to change current_job_. More...
 
bool obtain_new_job (bool re_consider_current_job=false)
 this function updates the current_job_id_ and current_job_ fields. The boolean return states whether or not a new job was obtained (if false, quit distributing!) More...
 
virtual void job_succeeded (core::pose::Pose &pose, core::Real run_time, std::string const &tag)
 This function is called upon a successful job completion; it has been virtualized so BOINC and MPI can delay/protect output base implementation is just a call to the job outputter. More...
 
virtual void job_succeeded_additional_output (core::pose::Pose &pose, std::string const &tag)
 This function is called upon a successful job completion if there are additional poses generated by the mover base implementation is just a call to the job outputter. More...
 
virtual void remove_bad_inputs_from_job_list ()
 this function is called inside go_main if a mover returns FAIL_BAD_INPUT. Its purpose is to remove other jobs with the same input (which will still be bad) from the available list of jobs. The default implementation is a no-op and not all distributors are expected/able to implement this functionality, only those that can guaruntee no other jobs of that input are currently running. More...
 
virtual void current_job_finished ()
 Derived classes are allowed to clean up any temporary files or data relating to the current job after the current job has completed. Called inside go_main loop. Default implementation is a no-op. More...
 
virtual void note_all_jobs_finished ()
 Derived classes are allowed to perform some kind of action when the job distributor runs out of jobs to execute. Called inside go_main. Default implementation is a no-op. More...
 
void clear_current_job_output ()
 
void check_for_parser_in_go_main ()
 Send a message to the screen indicating that the parser is in use and that the mover that's been input to go_main will not be used, but instead will be replaced by the Mover created by the parser. More...
 
bool using_parser () const
 Is the parser in use? More...
 
bool run_one_job (protocols::moves::MoverOP &mover, time_t allstarttime, std::string &last_inner_job_tag, std::string &last_output_tag, core::Size &last_batch_id, core::Size &retries_this_job, bool first_job)
 
void setup_pymol_observer (core::pose::Pose &pose)
 After the construction of the pose for this job, check the command line to determine if the pymol observer should be attached to it. More...
 
void write_output_from_job (core::pose::Pose &pose, protocols::moves::MoverOP mover_copy, protocols::moves::MoverStatus status, core::Size jobtime, core::Size &retries_this_job)
 After a job has finished running, figure out from the MoverStatus whether the pose should be written to disk (or wherever) along with any other poses that the mover might have generated along the way. More...
 
void increment_failed_jobs ()
 Increment the number of failed jobs. More...
 
core::Size get_job_time_estimate () const
 Get an estimate of the time to run an additional job. If it can't be estimated, return a time of zero. More...
 
void write_citations_and_clear_citation_tracking () const
 Write out information about all modules that have been used that should be cited, then clear the list of citations from the CitationManager. More...
 
void set_batch_id (core::Size setting)
 set current_batch_id — eg for slave nodes in MPI framework More...
 
virtual bool next_batch ()
 switch current_batch_id_ to next batch More...
 
virtual void batch_underflow ()
 if end of batches_ reached via next_batch or set_batch_id ... More...
 
virtual void load_new_batch ()
 called by next_batch() or set_batch_id() to switch-over and restart JobDistributor on new batch More...
 
core::Size nr_batches () const
 how many batches are in our list ... this can change dynamically More...
 
std::string const & batch (core::Size batch_id)
 give name of batch with given id More...
 
- Static Protected Member Functions inherited from protocols::jd2::JobDistributor
static void setup_system_signal_handler (void(*prev_fn)(int)=jd2_signal_handler)
 Setting up callback function that will be call when our process is about to terminate. This will allow us to exit propely (clean up in_progress_files/tmp files if any). More...
 
static void remove_system_signal_handler ()
 Set signal handler back to default state. More...
 
static void jd2_signal_handler (int Signal)
 Default callback function for signal handling. More...
 

Detailed Description

Job distributor subclass for running RECON multistate design Takes in all input poses from the command line and passes them to any mover or filter that derives from VectorPoseMover or VectorPoseFilter, meaning that it is able to receive and operate on multiple poses simultaneously. Only accessible through recon application.

Constructor & Destructor Documentation

protocols::jd2::VectorPoseJobDistributor::VectorPoseJobDistributor ( )
protocols::jd2::VectorPoseJobDistributor::~VectorPoseJobDistributor ( )
override

Member Function Documentation

bool protocols::jd2::VectorPoseJobDistributor::apply_parsed_protocol_mpi ( core::pose::PoseOP pose,
protocols::rosetta_scripts::ParsedProtocolOP protocol 
)
bool protocols::jd2::VectorPoseJobDistributor::apply_parsed_protocol_serial ( utility::vector1< core::pose::PoseOP > &  working_poses,
utility::vector1< protocols::rosetta_scripts::ParsedProtocolOP > &  protocols,
utility::vector1< core::Size > &  pose_order 
)
JobOP protocols::jd2::VectorPoseJobDistributor::current_job ( ) const
overridevirtual

Get current job. Robust to both MPI and non-MPI input.

Reimplemented from protocols::jd2::JobDistributor.

References current_nstruct_, current_pose_, job_map_, and this_nodes_job_.

core::Size protocols::jd2::VectorPoseJobDistributor::get_new_job_id ( )
overridevirtual

Get job ID of next job. Robust to both MPI and non-MPI input.

Implements protocols::jd2::JobDistributor.

References current_nstruct_, current_pose_, and protocols::wum::mpi_rank().

void protocols::jd2::VectorPoseJobDistributor::go ( protocols::moves::MoverOP  mover)
overridevirtual

This may be overridden by derived classes. Default implementation invokes go_main.

Reimplemented from protocols::jd2::JobDistributor.

References go_mpi(), and go_serial().

void protocols::jd2::VectorPoseJobDistributor::go_mpi ( protocols::moves::MoverOP  mover)
void protocols::jd2::VectorPoseJobDistributor::go_serial ( protocols::moves::MoverOP  mover)

Go method used for non-MPI jobs. First we gather all of the input poses, then we pass them to the movers specified in the ParsedProtocol either one after another (if it's a regular mover/filter) or all together (if it's a VectorPoseMover or VectorPoseFilter)

References apply_parsed_protocol_serial(), current_nstruct_, current_pose_, protocols::rosetta_scripts::RosettaScriptsParser::generate_mover(), protocols::jd2::JobDistributor::get_jobs(), protocols::jd2::JobDistributor::job_inputter(), job_inputter_, job_map_, protocols::jd2::JobDistributor::job_outputter(), job_outputter_, protocols::jd2::JobDistributor::parser(), randomize_input_, core::pose::setPoseExtraScore(), protocols::jd2::JobsContainer::size(), and protocols::jd2::TR().

Referenced by go().

void protocols::jd2::VectorPoseJobDistributor::handle_interrupt ( )
overridevirtual

This function got called when job is not yet finished and got termitated abnormaly (ctrl-c, kill etc). when implimenting it in subclasses make sure to delete all in-progress-data that your job spawns.

Implements protocols::jd2::JobDistributor.

void protocols::jd2::VectorPoseJobDistributor::job_failed ( core::pose::Pose ,
bool  will_retry 
)
overridevirtual

This function is called when we give up on the job; it has been virtualized so BOINC and MPI can delay/protect output.

Mark job as bad, so at the end of execution we know definitively how many jobs failed for any reason This function (in this classes implementation) increments the number_failed_jobs_ class variable. If you write a child JobDistributor and do not want an exception to be thrown at the end of execution if some jobs failed, be sure to override this function so that it does not increment number_failed_jobs_.

Mark job as bad, so at the end of execution we know definitively how many jobs failed for any reason

Reimplemented from protocols::jd2::JobDistributor.

void protocols::jd2::VectorPoseJobDistributor::mark_current_job_id_for_repetition ( )
overridevirtual

this function is called whenever a job "soft-fails" and needs to be retried. Generally it should ensure that the subsequent call to obtain_new_job returns this job over again.

Implements protocols::jd2::JobDistributor.

Member Data Documentation

core::Size protocols::jd2::VectorPoseJobDistributor::current_nstruct_
private
core::Size protocols::jd2::VectorPoseJobDistributor::current_pose_
private
JobInputterOP protocols::jd2::VectorPoseJobDistributor::job_inputter_
private

Referenced by go_serial().

std::map<core::Size, Jobs> protocols::jd2::VectorPoseJobDistributor::job_map_
private

Referenced by current_job(), go_mpi(), and go_serial().

JobOutputterOP protocols::jd2::VectorPoseJobDistributor::job_outputter_
private

Referenced by go_serial().

core::Size protocols::jd2::VectorPoseJobDistributor::number_jobs_
private

Referenced by go_mpi().

bool protocols::jd2::VectorPoseJobDistributor::randomize_input_
private
JobOP protocols::jd2::VectorPoseJobDistributor::this_nodes_job_
private

Referenced by current_job(), and go_mpi().


The documentation for this class was generated from the following files: