21 #include <basic/resource_manager/JobOptions.hh>
32 #include <utility/io/izstream.hh>
33 #include <utility/excn/Exceptions.hh>
34 #include <utility/pointer/ReferenceCount.hh>
35 #include <utility/tag/Tag.hh>
36 #include <utility/file/FileName.hh>
37 #include <utility/options/keys/BooleanOptionKey.hh>
38 #include <utility/options/keys/IntegerOptionKey.hh>
39 #include <utility/options/keys/FileOptionKey.hh>
40 #include <utility/options/keys/PathOptionKey.hh>
41 #include <utility/options/keys/RealOptionKey.hh>
42 #include <utility/options/keys/StringOptionKey.hh>
43 #include <utility/string_util.hh>
44 #include <utility/sql_database/DatabaseSessionManager.hh>
47 #include <basic/Tracer.hh>
48 #include <basic/options/option.hh>
49 #include <basic/options/keys/OptionKeys.hh>
50 #include <basic/options/keys/jd2.OptionKeys.gen.hh>
51 #include <basic/options/keys/out.OptionKeys.gen.hh>
52 #include <basic/database/sql_utils.hh>
55 #include <boost/lexical_cast.hpp>
58 #include <cppdb/frontend.h>
68 using utility::excn::EXCN_Msg_Exception;
69 using basic::resource_manager::ResourceOP;
70 using basic::resource_manager::ResourceManager;
71 using basic::resource_manager::ResourceTag;
72 using basic::resource_manager::JobOptions;
73 using basic::resource_manager::JobOptionsOP;
79 using std::stringstream;
81 static basic::Tracer
tr(
"protocols.jd2.JD2ResourceManagerJobInputter");
89 return "JD2ResourceManagerJobInputter";
109 tr.Debug <<
"JD2ResourceManagerJobInputter::pose_from_job" << endl;
111 std::string const & input_tag(job->inner_job()->input_tag());
122 if ( !job->inner_job()->get_pose() ) {
124 <<
"Retrieving pose from ResourceManager (tag = " << input_tag <<
")" << endl;
131 if(jd2_resource_manager->has_resource_tag_by_job_tag(
"residue", input_tag))
133 ResourceOP residue_resource(jd2_resource_manager->get_resource_by_job_tag(
"residue",input_tag));
136 std::string type_set_name(new_residue->residue_type_set().name());
139 tr <<
"loading residue " << new_residue->name() <<
" into " << type_set_name <<
" residue_type_set" <<std::endl;
145 tr <<
"Loading startstruct " << jd2_resource_manager->find_resource_tag_by_job_tag(
"startstruct", input_tag ) <<
" for job " <<
146 input_tag <<std::endl;
147 resource = jd2_resource_manager->get_resource_by_job_tag(
"startstruct", input_tag);
148 }
catch ( utility::excn::EXCN_Msg_Exception
const & e ) {
149 std::ostringstream err;
150 err << e.msg() << std::endl;
151 err <<
"Failed to access 'startstruct' resource from the JD2ResourceManager for job '";
152 err << input_tag <<
"' with nstruct index " << job->nstruct_index();
153 err <<
"\n" <<
"Exception caught and re-thrown from JD2ResourceManagerJobInputter::pose_from_job\n";
154 throw utility::excn::EXCN_Msg_Exception( err.str() );
157 PoseOP resource_pose( dynamic_cast< Pose * > ( resource() ) );
160 if ( ! resource_pose ) {
161 std::ostringstream err;
163 <<
"Error trying to access starting structure (startstruct) "
164 <<
"for job with tag '";
165 err << input_tag <<
"'.";
166 if ( jd2_resource_manager->has_resource_tag_by_job_tag(
"startstruct", input_tag) ) {
167 ResourceTag rt(jd2_resource_manager->find_resource_tag_by_job_tag(
"startstruct", input_tag));
169 <<
" The resource tag '" << rt <<
"' "
170 <<
"for this job is not for a Pose object" << endl;
172 err <<
" This starting structure for this job is critically absent\n";
174 throw EXCN_Msg_Exception( err.str() );
179 pose = *resource_pose;
182 pose = *(job->inner_job()->get_pose());
184 <<
"filling pose from saved copy (tag = "
185 << job->input_tag() <<
")" << endl;
193 tr <<
"Initializing jobs from resource definition files" << std::endl;
195 = basic::options::option[ basic::options::OptionKeys::jd2::resource_definition_files ];
196 for (
core::Size ii = 1; ii <= resource_definition_files.size(); ++ii ) {
198 tr.Debug <<
"Reading from resource definition file " << resource_definition_files[ii] << std::endl;
199 utility::io::izstream instream( resource_definition_files[ii]().c_str() );
211 jd2_resource_manager->mark_job_tag_as_complete(job_tag);
212 std::list<ResourceTag> resources_for_job(jd2_resource_manager->get_resource_tags_for_job_tag(job_tag));
214 std::list<ResourceTag>::iterator resource_list_it = resources_for_job.begin();
215 for(; resource_list_it != resources_for_job.end(); ++resource_list_it)
217 core::Size job_count(jd2_resource_manager->get_count_of_jobs_associated_with_resource_tag(*resource_list_it));
220 if(!jd2_resource_manager->ResourceManager::has_resource(*resource_list_it)){
221 tr <<
"Skipping deleting '" << *resource_list_it <<
"' because it doesn't exist in the ResourceManager." << std::endl;
226 ResourceOP current_residue = jd2_resource_manager->find_resource(*resource_list_it);
231 std::string residue_type_set = new_residue->residue_type_set().name();
236 tr <<
"Deleting resource " << *resource_list_it <<std::endl;
238 jd2_resource_manager->free_resource_by_tag(*resource_list_it);
251 for ( utility::tag::Tag::tags_t::const_iterator
252 tag_iter = resource_tags->getTags().begin(),
253 tag_iter_end = resource_tags->getTags().end();
254 tag_iter != tag_iter_end; ++tag_iter ) {
255 std::string const & tagname = (*tag_iter)->getName();
256 if ( tagname ==
"ResourceLocators" ) {
258 }
else if ( tagname ==
"ResourceOptions" ) {
260 }
else if ( tagname ==
"Resources" ) {
262 }
else if ( tagname ==
"Jobs" ) {
275 std::map< std::string, std::string > generic_resources_for_job;
276 JobOptionsOP generic_job_options(
new JobOptions());
278 for ( utility::tag::Tag::tags_t::const_iterator
279 tag_iter = jobs_tags->getTags().begin(),
280 tag_iter_end = jobs_tags->getTags().end();
281 tag_iter != tag_iter_end; ++tag_iter ) {
282 std::string const & tagname = (*tag_iter)->getName();
283 if ( tagname ==
"Option" ) {
285 }
else if ( tagname ==
"Data" ) {
288 *tag_iter,
"generic", dummy_input_tag,
289 generic_resources_for_job );
294 for ( utility::tag::Tag::tags_t::const_iterator
295 tag_iter = jobs_tags->getTags().begin(),
296 tag_iter_end = jobs_tags->getTags().end();
297 tag_iter != tag_iter_end; ++tag_iter ) {
298 std::string const & tagname = (*tag_iter)->getName();
299 if ( tagname ==
"Job" ) {
300 parse_job_tag( *tag_iter, generic_resources_for_job, *generic_job_options, jobs );
301 }
else if( tagname ==
"JobsTable"){
304 std::ostringstream err;
305 err <<
"Error parsing jobs tags in JD2ResourceManagerJobInputter: unrecognized tag '" << tagname <<
"'";
306 EXCN_Msg_Exception( err.str() );
316 std::map< std::string, std::string >
const & generic_resources_for_job,
317 JobOptions
const & generic_job_options,
326 std::map< std::string, std::string > resources_for_job(generic_resources_for_job);
330 if ( jobs_tag->hasOption(
"name" )) {
331 jobname = jobs_tag->getOption<
std::string >(
"name" );
334 JobOptionsOP job_options =
new JobOptions(generic_job_options);
335 for ( utility::tag::Tag::tags_t::const_iterator
336 tag_iter = jobs_tag->getTags().begin(),
337 tag_iter_end = jobs_tag->getTags().end();
338 tag_iter != tag_iter_end; ++tag_iter ) {
339 std::string const & tagname = (*tag_iter)->getName();
340 if ( tagname ==
"Option" ) {
342 }
else if ( tagname ==
"Data" ) {
344 }
else if (tagname ==
"ResidueType") {
349 if(jobs_tag->hasOption(
"nstruct")){
353 "nstruct", jobs_tag->getOption<
string>(
"nstruct"), job_options);
356 if ( jobname.size() == 0 ) {
357 if ( jd2rm->has_resource_configuration( input_tag ) ) {
358 std::ostringstream err;
359 err <<
"Repeat input startstruct for a job which has not been given a name. Ordinarily, if a job is\n";
360 err <<
"given without a name, it is assigned a name based on its startstruct. If, however, the same\n";
361 err <<
"startstruct is given multiple times, then we cannot ensure that job names are unique. Please\n";
362 err <<
"give each job with a shared startstrct a different name.\n";
363 err <<
"Offeding startstruct: '" << input_tag <<
"\n";
364 throw EXCN_Msg_Exception( err.str() );
370 record_job(jobname, resources_for_job, job_options, jobs);
376 std::map< std::string, std::string >
const & generic_resources_for_job,
377 JobOptions
const & generic_job_options,
380 using namespace basic::database;
382 utility::sql_database::sessionOP db_session = parse_database_connection(tag);
385 if(tag->hasOption(
"sql_command")){
386 sql_command = tag->getOption<
string>(
"sql_command");
387 check_statement_sanity(sql_command);
389 stringstream err_msg;
391 <<
"The JobsTable tag requires a 'sql_command' tag that "
392 <<
"is an SQL SELECT statement that returns the following column formats" << endl
393 <<
"ordered by <job_name>:" << endl
394 <<
"\t(<job_name>, 'Resource', <desc>, <resource_tag>)" << endl
395 <<
"\t(<job_name>, 'Option', <option_key>, <option_value>)" << endl;
396 throw utility::excn::EXCN_Msg_Exception(err_msg.str());
399 cppdb::statement select_stmt(safely_prepare_statement(sql_command, db_session));
400 cppdb::result res(safely_read_from_database(select_stmt));
403 "Each row of the jobs table should have one of the following formats\n"
405 " job_name, 'Resource', desc, resource_tag\n"
406 " job_name, 'Option', option_key, option_value\n"
408 " * desc: A job-agnostic description for a resource like 'native' or 'symm_data'\n"
409 " that can be referenced in the protocol.\n"
411 " * resource_tag: The tag of a resource described in the <Resources/> block.\n"
413 " * option_key: An optionally namespaced option key (string) for the options\n"
414 " system like 'in:file:native'\n"
416 " * option_value: A value or list of values that processed into the option system\n";
419 stringstream err_msg;
421 <<
"The JobsTable tag requires a 'sql_command' tag" << endl
422 << job_table_schema << endl
423 <<
"Instead, the query returned " << res.cols() <<
":" << endl
424 <<
"SQL query:" << endl
425 << sql_command << endl;
426 throw utility::excn::EXCN_Msg_Exception(err_msg.str());
430 string previous_job_name(
"");
432 std::map< string, string > resources_for_job(generic_resources_for_job);
433 JobOptionsOP job_options =
new JobOptions(generic_job_options);
437 string job_name, resource_type, key, value;
438 res >> job_name >> resource_type >> key >> value;
440 if(row_number != 1 && previous_job_name != job_name){
443 record_job(previous_job_name, resources_for_job, job_options, jobs);
444 resources_for_job = generic_resources_for_job;
445 job_options =
new JobOptions(generic_job_options);
446 previous_job_name = job_name;
451 if(resource_type ==
"Resource"){
452 resources_for_job[ key ] = value;
453 }
else if (resource_type ==
"Option"){
456 stringstream err_msg;
458 <<
"Unrecognized data type '" << resource_type <<
"' for job '" << job_name <<
"'" << endl
459 <<
"The JobsTable tag requires a 'sql_command' tag" << endl
460 << job_table_schema << endl
462 <<
"SQL query:" << endl
463 << sql_command << endl
465 <<
"Resources:" << endl;
466 for(std::map<string,string>::const_iterator i=resources_for_job.begin(), ie=resources_for_job.end(); i != ie; ++i){
467 err_msg <<
"\t '" << i->first <<
"' <- '" << i->second <<
"'" << endl;
470 <<
"Options:" << endl
471 << job_options << endl;
473 throw EXCN_Msg_Exception(err_msg.str());
476 if(previous_job_name.empty()){
477 previous_job_name = job_name;
482 tr.Warning <<
"JobsTable returned no rows." << endl;
485 record_job(previous_job_name, resources_for_job, job_options, jobs);
490 string const & job_name,
491 std::map< string, string >
const & resources_for_job,
492 JobOptionsOP job_options,
499 using namespace basic::options;
501 for ( std::map< string, string >::const_iterator
502 iter = resources_for_job.begin(), iter_end = resources_for_job.end();
503 iter != iter_end; ++iter ) {
504 jd2rm->add_resource_tag_by_job_tag( iter->first, job_name, iter->second );
508 job_name, job_options);
512 for(Jobs::const_iterator ii = jobs.begin(), iie = jobs.end(); ii != iie; ++ii){
513 if( (*ii)->input_tag() == job_name ) {
521 if(job_options->has_option(OptionKeys::out::nstruct)){
522 nstruct = job_options->get_option(OptionKeys::out::nstruct);
526 for (
Size ii = 1; ii <= nstruct; ++ii ) {
527 jobs.push_back(
new Job( inner_job, ii ));
530 if(job_options->has_option(OptionKeys::out::nstruct)){
531 Size requested_nstruct = job_options->get_option(OptionKeys::out::nstruct);
532 if(requested_nstruct != n_jobs){
533 std::stringstream err_msg;
535 <<
"Conflicting specification for nstruct for job with name '" << job_name <<
"'" << std::endl
536 <<
"Previous nstruct=" << n_jobs <<
", new nstruct=" << requested_nstruct << std::endl;
537 throw EXCN_Msg_Exception( err_msg.str() );
546 JobOptionsOP job_options
549 for ( utility::tag::Tag::options_t::const_iterator
550 opt_iter = options_tag->getOptions().begin(),
551 opt_iter_end = options_tag->getOptions().end();
552 opt_iter != opt_iter_end; ++opt_iter ) {
564 JobOptionsOP job_options
567 using namespace basic::options;
571 full_key = option.find_key_cl(optname,
"",
true);
573 std::stringstream err_msg;
575 <<
"Error: Option key '" << optname <<
"' not found. Please remember to use only one colon when giving options." << endl;
576 throw EXCN_Msg_Exception( err_msg.str() );
579 if ( basic::options::OptionKeys::has( full_key ) ) {
580 OptionKey
const & opt( basic::options::OptionKeys::key( full_key ));
581 if ( opt.scalar() ) {
583 if ( dynamic_cast< BooleanOptionKey const * > (&opt) ) {
584 BooleanOptionKey
const & boolopt( static_cast< BooleanOptionKey const & > (opt) );
586 }
else if ( dynamic_cast< FileOptionKey const * > (&opt) ) {
587 FileOptionKey
const & fileopt( static_cast< FileOptionKey const & > (opt) );
589 }
else if ( dynamic_cast< IntegerOptionKey const * > (&opt) ) {
590 IntegerOptionKey
const & iopt( static_cast< IntegerOptionKey const & > (opt) );
592 }
else if ( dynamic_cast< PathOptionKey const * > (&opt) ) {
593 PathOptionKey
const & pathopt( static_cast< PathOptionKey const & > (opt) );
595 }
else if ( dynamic_cast< RealOptionKey const * > (&opt) ) {
596 RealOptionKey
const & ropt( static_cast< RealOptionKey const & > (opt) );
598 }
else if ( dynamic_cast< StringOptionKey const * > (&opt) ) {
599 StringOptionKey
const & stopt( static_cast< StringOptionKey const & > (opt) );
606 if ( dynamic_cast< BooleanVectorOptionKey const * > (&opt) ) {
607 BooleanVectorOptionKey
const & boolvectopt( static_cast< BooleanVectorOptionKey const & > (opt) );
609 }
else if ( dynamic_cast< FileVectorOptionKey const * > (&opt) ) {
610 FileVectorOptionKey
const & filevectopt( static_cast< FileVectorOptionKey const & > (opt) );
612 }
else if ( dynamic_cast< IntegerVectorOptionKey const * > (&opt) ) {
613 IntegerVectorOptionKey
const & ivectopt( static_cast< IntegerVectorOptionKey const & > (opt) );
615 }
else if ( dynamic_cast< PathVectorOptionKey const * > (&opt) ) {
616 PathVectorOptionKey
const & pathvectopt( static_cast< PathVectorOptionKey const & > (opt) );
618 }
else if ( dynamic_cast< RealVectorOptionKey const * > (&opt) ) {
619 RealVectorOptionKey
const & rvectopt( static_cast< RealVectorOptionKey const & > (opt) );
621 }
else if ( dynamic_cast< StringVectorOptionKey const * > (&opt) ) {
622 StringVectorOptionKey
const & stvectopt( static_cast< StringVectorOptionKey const & > (opt) );
627 std::ostringstream err;
628 err <<
"Error: option '" << optname <<
"' corresponding to the full key '" << full_key <<
"' does not match any existing option in Rosetta.\n";
629 err <<
"Thrown from JD2ResourceManagerJobInputter::parse_job_tag\n";
630 throw EXCN_Msg_Exception( err.str() );
636 basic::options::BooleanOptionKey
const & boolopt,
639 basic::resource_manager::JobOptionsOP job_options
644 boolval = boost::lexical_cast<
bool >( val );
645 }
catch ( boost::bad_lexical_cast
const& ) {
646 std::ostringstream err;
647 err <<
"Error converting value '" << val <<
"' given for option '" << optname <<
"' to a boolean from within JD2ResourceManagerJobInputter::parse_job_tag\n Boolean options must be given either a '1' or a '0'";
648 throw EXCN_Msg_Exception( err.str() );
650 job_options->add_option( boolopt, boolval );
656 basic::options::FileOptionKey
const & fileopt,
659 basic::resource_manager::JobOptionsOP job_options
662 job_options->add_option( fileopt, val );
668 basic::options::IntegerOptionKey
const & intopt,
671 basic::resource_manager::JobOptionsOP job_options
676 intval = boost::lexical_cast<
int >( val );
677 }
catch ( boost::bad_lexical_cast
const& ) {
678 std::ostringstream err;
679 err <<
"Error converting value '" << val <<
"' given for option '"
680 << optname <<
"' to an integer from within JD2ResourceManagerJobInputter::parse_job_tag\n";
681 throw EXCN_Msg_Exception( err.str() );
683 job_options->add_option( intopt, intval );
689 basic::options::PathOptionKey
const & pathopt,
692 basic::resource_manager::JobOptionsOP job_options
695 job_options->add_option( pathopt, val );
701 basic::options::RealOptionKey
const & realopt,
704 basic::resource_manager::JobOptionsOP job_options
709 realval = boost::lexical_cast<
core::Real >( val );
710 }
catch ( boost::bad_lexical_cast
const& ) {
711 std::ostringstream err;
712 err <<
"Error converting value '" << val <<
"' given for option '" << optname <<
"' to a floating point number from within JD2ResourceManagerJobInputter::parse_job_tag\n";
713 throw EXCN_Msg_Exception( err.str() );
715 job_options->add_option( realopt, realval );
720 basic::options::StringOptionKey
const & stringopt,
723 basic::resource_manager::JobOptionsOP job_options
726 job_options->add_option( stringopt, val );
732 basic::options::BooleanVectorOptionKey
const & boolvectopt,
736 basic::resource_manager::JobOptionsOP job_options
740 for (
Size ii = 1; ii <= vals.size(); ++ii ) {
743 boolval = boost::lexical_cast<
bool >( vals[ii] );
744 }
catch ( boost::bad_lexical_cast
const& ) {
745 std::ostringstream err;
746 err <<
"Error converting value '" << vals[ii] <<
"', option # " << ii
747 <<
", given for the comma-separated vector option '"
748 << optname <<
"' to a boolean\nfrom within JD2ResourceManagerJobInputter::parse_job_tag\n"
749 <<
"Original value string: '" << val <<
"'\n"
750 <<
"Boolean options must be given either a '1' or a '0'\n";
751 throw EXCN_Msg_Exception( err.str() );
753 boolvect[ ii ] = boolval;
755 job_options->add_option( boolvectopt, boolvect );
760 basic::options::FileVectorOptionKey
const & filevectopt,
764 basic::resource_manager::JobOptionsOP job_options
767 job_options->add_option( filevectopt, vals );
772 basic::options::IntegerVectorOptionKey
const & intvectopt,
776 basic::resource_manager::JobOptionsOP job_options
780 for (
Size ii = 1; ii <= vals.size(); ++ii ) {
783 intval = boost::lexical_cast<
int >( vals[ii] );
784 }
catch ( boost::bad_lexical_cast
const& ) {
785 std::ostringstream err;
786 err <<
"Error converting value '" << vals[ii] <<
"', option # " << ii
787 <<
", given for the comma-separated vector option '"
788 << optname <<
"' to an integer\nfrom within JD2ResourceManagerJobInputter::parse_job_tag\n"
789 <<
"Original value string: '" << val <<
"'\n";
790 throw EXCN_Msg_Exception( err.str() );
792 intvect[ ii ] = intval;
794 job_options->add_option( intvectopt, intvect );
799 basic::options::PathVectorOptionKey
const & pathvectopt,
803 basic::resource_manager::JobOptionsOP job_options
806 job_options->add_option( pathvectopt, vals );
811 basic::options::RealVectorOptionKey
const & realvectopt,
815 basic::resource_manager::JobOptionsOP job_options
819 for (
Size ii = 1; ii <= vals.size(); ++ii ) {
822 realval = boost::lexical_cast<
core::Real >( vals[ii] );
823 }
catch ( boost::bad_lexical_cast
const& ) {
824 std::ostringstream err;
825 err <<
"Error converting value '" << vals[ii] <<
"', option # " << ii <<
", given for the comma-separated vector option '"
826 << optname <<
"' to a boolean\nfrom within JD2ResourceManagerJobInputter::parse_job_tag\n"
827 <<
"Original value string: '" << val <<
"'\n";
828 throw EXCN_Msg_Exception( err.str() );
830 realvect[ ii ] = realval;
832 job_options->add_option( realvectopt, realvect );
837 basic::options::StringVectorOptionKey
const & strinvectopt,
841 basic::resource_manager::JobOptionsOP job_options
844 job_options->add_option( strinvectopt, vals );
851 std::map< std::string, std::string > & resources_for_job
855 std::ostringstream err;
856 if(!options_tag->hasOption(
"resource_tag"))
858 err <<
"you must specify the resource_tag option when using a ResidueType tag";
860 throw EXCN_Msg_Exception( err.str() );
862 for ( utility::tag::Tag::options_t::const_iterator
863 opt_iter = options_tag->getOptions().begin(),
864 opt_iter_end = options_tag->getOptions().end();
865 opt_iter != opt_iter_end; ++opt_iter ) {
866 if(opt_iter->first ==
"resource_tag")
868 rname = opt_iter->second;
869 resources_for_job[
"residue"] = rname;
889 std::map< std::string, std::string > & resources_for_job
894 bool desc_found(
false );
895 bool resource_found(
false );
896 bool pdb_found(
false );
897 bool local_startstruct_found(
false );
901 for ( utility::tag::Tag::options_t::const_iterator
902 opt_iter = data_tag->getOptions().begin(),
903 opt_iter_end = data_tag->getOptions().end();
904 opt_iter != opt_iter_end; ++opt_iter ) {
905 if ( opt_iter->first ==
"desc" ) {
906 if ( opt_iter->second ==
"startstruct" ) {
907 local_startstruct_found =
true;
910 desc = opt_iter->second;
911 }
else if ( opt_iter->first ==
"resource_tag" ) {
912 resource_found =
true;
913 rname = opt_iter->second;
914 }
else if ( opt_iter->first ==
"pdb" ) {
916 rname = opt_iter->second;
917 }
else if (opt_iter->first ==
"locator")
919 locator = opt_iter->second;
924 bool in_error =
false;
925 std::ostringstream err;
926 if ( ! desc_found ) {
928 err <<
"Failed to find a data description (desc) amongst the options pairs listed reading a 'Data' tag in a Job tag.\n A desc option must always be given.\n";
930 if ( rname.size() == 0 ) {
932 err <<
"Failed to find a resource name or a pdb name reading a 'Data' tag in a Job tag. Either a 'resource_tag' or a 'pdb' option must be provided.\n";
934 if ( resource_found && pdb_found ) {
936 err <<
"Error: Both a 'resource_tag' and a 'pdb' tag were found for a 'Data' tag in the Job tag." << std::endl;
937 }
else if ( resource_found && ! jd2rm->has_resource_configuration( rname )) {
939 err <<
"Error: In Data subtag with descr='" << desc <<
"', the ResourceManager has no resource configuration for ResourceTag '" << rname <<
"'.\n";
941 if ( ! local_startstruct_found && pdb_found ) {
943 err <<
"Error: 'pdb' tag given for a non-'startstruct' option in the 'Data' tag of a Job tag." << std::endl;
945 if ( resources_for_job.find( desc ) != resources_for_job.end() ) {
947 err <<
"Error: description '" << desc <<
"' appears twice";
948 err <<
".\nFirst specified as '" << resources_for_job[ desc ] <<
"', and now as '" << rname <<
"'.";
949 err <<
"A 'desc' may only be given once\n";
953 err <<
"Problem encountered ";
954 if ( jobname.size() != 0 ) {
955 err <<
"for job named '" << jobname <<
"'";
956 }
else if ( desc !=
"startstruct" && resources_for_job.find(
"startstruct") != resources_for_job.end()) {
957 err <<
"for job whose starstruct is given as '" << resources_for_job[
"startstruct" ] <<
"'";
959 err <<
".\nOptions given:\n";
960 for ( utility::tag::Tag::options_t::const_iterator
961 opt_iter = data_tag->getOptions().begin(),
962 opt_iter_end = data_tag->getOptions().end();
963 opt_iter != opt_iter_end; ++opt_iter ) {
964 err <<
"\t(" << opt_iter->first <<
", " << opt_iter->second <<
")\n";
966 err <<
"Thrown from protocols::jd2::JD2ResourceManagerJobInputter::parse_job_tag\n";
967 throw EXCN_Msg_Exception( err.str() );
970 if ( local_startstruct_found && pdb_found ) {
975 std::string pdb_resource_name =
"pdb_resource_" + rname;
976 if ( jd2rm->has_resource_configuration( pdb_resource_name ) ) {
979 tr <<
"Adding implicit resource '" << pdb_resource_name <<
"' for job whose startstruct is given as pdb='" << rname <<
"'.";
980 basic::resource_manager::ResourceConfiguration rconfig;
981 rconfig.resource_tag = pdb_resource_name;
982 rconfig.locator_tag = locator;
983 rconfig.locator_id = rname;
984 rconfig.loader_type =
"PoseFromPDB";
985 rconfig.resource_options_tag =
"";
986 jd2rm->add_resource_configuration( pdb_resource_name, rconfig );
988 resources_for_job[ desc ] = pdb_resource_name;
992 resources_for_job[ desc ] = rname;
1005 Jobs::const_iterator job=jobs.begin(), jobs_end=jobs.end();
1006 job != jobs_end; ++job){
1007 if(!(jd2rm->has_resource_tag_by_job_tag(
"startstruct", (*job)->input_tag()))) {
1008 std::stringstream errmsg;
1010 <<
"Error: Job '" << (*job)->input_tag() <<
"' given without a 'startstruct'";
1011 throw EXCN_Msg_Exception( errmsg.str() );