19 #include <basic/resource_manager/types.hh>
20 #include <basic/resource_manager/FallbackConfiguration.hh>
21 #include <basic/resource_manager/FallbackConfigurationFactory.hh>
22 #include <basic/resource_manager/JobOptions.hh>
27 #include <basic/options/option.hh>
30 #include <numeric/random/random.hh>
33 #include <basic/Tracer.hh>
34 #include <basic/resource_manager/types.hh>
35 #include <basic/resource_manager/ResourceLoader.hh>
36 #include <basic/resource_manager/ResourceLoaderFactory.hh>
37 #include <basic/resource_manager/ResourceLocator.hh>
38 #include <basic/resource_manager/ResourceLocatorFactory.hh>
39 #include <basic/resource_manager/ResourceOptions.hh>
40 #include <basic/resource_manager/ResourceOptionsFactory.hh>
41 #include <basic/database/sql_utils.hh>
44 #include <utility/vector1.hh>
45 #include <utility/exit.hh>
46 #include <utility/tag/Tag.hh>
47 #include <utility/excn/Exceptions.hh>
48 #include <utility/string_util.hh>
49 #include <utility/sql_database/DatabaseSessionManager.hh>
52 #include <boost/foreach.hpp>
53 #define foreach BOOST_FOREACH
56 #include <cppdb/frontend.h>
66 using std::stringstream;
70 using basic::resource_manager::ResourceManager;
71 using basic::resource_manager::ResourceDescription;
72 using basic::resource_manager::ResourceOP;
73 using basic::resource_manager::JobOptionsOP;
74 using utility::excn::EXCN_Msg_Exception;
75 using basic::resource_manager::LoaderType;
76 using basic::resource_manager::LocatorTag;
77 using basic::resource_manager::LocatorID;
78 using basic::resource_manager::ResourceConfiguration;
79 using basic::resource_manager::ResourceOptionsTag;
80 using basic::resource_manager::ResourceLoaderFactory;
81 using basic::resource_manager::ResourceTag;
82 using utility::tag::Tag;
85 static Tracer
TR(
"protocols.resource_manager.planner.JD2ResourceManager");
99 return "JD2ResourceManager";
105 basic::resource_manager::LazyResourceManager::clear();
119 using basic::resource_manager::ResourceLocatorFactory;
120 using basic::resource_manager::ResourceLocatorOP;
121 using basic::resource_manager::LocatorTag;
122 using utility::tag::Tag;
123 typedef utility::excn::EXCN_Msg_Exception MsgException;
125 for ( Tag::tags_t::const_iterator
126 tag_iter = tags->getTags().begin(),
127 tag_iter_end = tags->getTags().end();
128 tag_iter != tag_iter_end; ++tag_iter ) {
129 std::string const & locator_type = (*tag_iter)->getName();
132 if ( ! (*tag_iter)->hasOption(
"tag" ) ) {
133 std::ostringstream err;
134 err <<
"Unable to find a 'tag' for a ResourceLocator of type '" << locator_type <<
"'\n";
135 throw MsgException( err.str() );
137 LocatorTag locator_tag = (*tag_iter)->getOption< LocatorTag >(
"tag" );
140 if ( LazyResourceManager::has_resource_locator( locator_tag ) ) {
141 std::ostringstream err;
142 err <<
"Duplicated tag, '" << locator_tag <<
"' assigned to a ResourceLocator object with type '";
143 err << locator_type <<
"'.\n";
144 err <<
"Prevous ResourceLocator object with this tag was of type '";
145 err << LazyResourceManager::find_resource_locator( locator_tag )->type() <<
"'\n";
146 throw MsgException( err.str() );
151 ResourceLocatorOP resource_locator;
153 resource_locator = ResourceLocatorFactory::get_instance()->create_resource_locator( locator_type, locator_tag, *tag_iter );
154 }
catch ( MsgException
const & e ) {
155 std::ostringstream err;
156 err << e.msg() <<
"\n";
157 err <<
"Exception thrown while trying to initialize a ResourceLocator of type '";
158 err << locator_type <<
"' with a tag of '" << locator_tag <<
"'\n";
159 err <<
"from JD2ResourceManager::read_resource_locators_tags\n";
160 throw MsgException( err.str() );
162 LazyResourceManager::add_resource_locator( locator_tag, resource_locator );
171 using utility::tag::Tag;
172 typedef utility::excn::EXCN_Msg_Exception MsgException;
174 for ( Tag::tags_t::const_iterator
175 tag_iter = tags->getTags().begin(),
176 tag_iter_end = tags->getTags().end();
177 tag_iter != tag_iter_end; ++tag_iter ) {
178 std::string const & tagname = (*tag_iter)->getName();
180 if(tagname ==
"OptionsTable") {
193 using namespace basic::database;
195 utility::sql_database::sessionOP db_session = parse_database_connection(tag);
198 if(tag->hasOption(
"sql_command")){
199 sql_command = tag->getOption<
string>(
"sql_command");
200 check_statement_sanity(sql_command);
202 stringstream err_msg;
204 <<
"The OptionsTable Table tag requires a 'sql_command' tag that "
205 <<
"is an SQL SELECT statement that returns the following column formats" << endl
206 <<
"ordered by <job_name>:" << endl
207 <<
"\t(<resource_options_tag>, <resource_options_type>, <resource_option_key>, resource_option_value>)" << endl;
208 throw utility::excn::EXCN_Msg_Exception(err_msg.str());
211 cppdb::statement select_stmt(safely_prepare_statement(sql_command, db_session));
212 cppdb::result res(safely_read_from_database(select_stmt));
215 "Each row of the resource options table should have the following format\n"
217 " resource_options_tag, resource_options_type, resource_option_key, resource_option_value\n"
219 " * The table should 'ORDER BY job_name', to have data for a\n"
220 " specific job adjacent in the table\n"
222 " * resource_option_{key, value}: Each resource options takes set of key value pairs (string -> string)\n"
223 " for example, for PoseFromPDBOptions, has the key 'exit_if_missing_heavy_atoms' and takes '1' for true or '0' for false.\n";
226 stringstream err_msg;
228 <<
"The OptionsTable tag requires a 'sql_command' tag" << endl
229 << table_schema << endl
230 <<
"Instead, the query returned " << res.cols() <<
":" << endl
231 <<
"SQL query:" << endl
232 << sql_command << endl;
233 throw utility::excn::EXCN_Msg_Exception(err_msg.str());
237 std::map< string, TagPtr > tags;
241 string tag, type, key, value;
242 res >> tag >> type >> key >> value;
244 std::map< string, TagPtr >::iterator
t(tags.find(tag));
246 TagPtr newtag =
new Tag();
247 newtag->setOption(
"tag", tag);
248 newtag->setName(type);
250 newtag->setOption(key, value);
254 t->second->setOption(key, value);
259 TR.Warning <<
"JobsTable returned no rows." << endl;
263 std::map<string, TagPtr>::const_iterator
t=tags.begin(), te=tags.end();
274 using basic::resource_manager::ResourceOptionsFactory;
275 using basic::resource_manager::ResourceOptionsOP;
276 using basic::resource_manager::ResourceOptionsTag;
277 typedef utility::excn::EXCN_Msg_Exception MsgException;
282 if ( ! tag->hasOption(
"tag" ) ) {
283 std::ostringstream err;
284 err <<
"Unable to find a 'tag' for a ResourceOption of type '" << tagname <<
"'\n";
285 throw MsgException( err.str() );
287 ResourceOptionsTag options_tag = tag->getOption< ResourceOptionsTag >(
"tag" );
290 if ( LazyResourceManager::has_resource_options( options_tag ) ) {
291 std::ostringstream err;
292 err <<
"Duplicated tag, '" << options_tag <<
"' assigned to a ResourceOptions object with type '";
293 err << tagname <<
"'.\n";
294 err <<
"Prevous ResourceOptions object with this tag was of type '";
295 err << LazyResourceManager::find_resource_options( options_tag )->type() <<
"'\n";
296 throw MsgException( err.str() );
301 ResourceOptionsOP resource_options;
303 resource_options = ResourceOptionsFactory::get_instance()->create_resource_options( tagname, tag );
304 }
catch ( MsgException
const & e ) {
305 std::ostringstream err;
306 err << e.msg() <<
"\n";
307 err <<
"Exception thrown while trying to initialize a ResourceOption of type '";
308 err << tagname <<
"' with a tag of '" << options_tag <<
"'\n";
309 err <<
"from JD2ResourceManager::read_resource_options_tags\n";
310 throw MsgException( err.str() );
312 LazyResourceManager::add_resource_options( options_tag, resource_options );
320 LoaderType
const & loader_type
322 typedef utility::excn::EXCN_Msg_Exception MsgException;
325 if ( ! ResourceLoaderFactory::get_instance()->has_resource_loader( loader_type ) ) {
326 std::ostringstream err;
327 err <<
"ResourceLoader type '" << loader_type <<
"' requested in JD2ResourceManager::read_resources_tags has not been registered with the ResourceLoaderFactory. Available types include:.\n";
328 std::list< std::string > loader_types = ResourceLoaderFactory::get_instance()->available_resource_loaders();
329 for ( std::list< std::string >::const_iterator
330 iter = loader_types.begin(), iter_end = loader_types.end(); iter != iter_end; ++iter ) {
331 err <<
" '" << *iter << std::endl;
333 throw MsgException( err.str() );
342 LoaderType
const & loader_type,
343 LocatorID
const & locator_id
345 typedef utility::excn::EXCN_Msg_Exception MsgException;
349 ResourceTag resource_tag;
350 if ( ! tag->hasOption(
"tag" ) ) {
351 resource_tag = locator_id;
353 resource_tag = tag->getOption< ResourceTag >(
"tag" );
357 if ( LazyResourceManager::has_resource_configuration( resource_tag ) ) {
358 std::ostringstream err;
359 err <<
"Duplicated tag, '" << resource_tag <<
"' assigned to a Resource object with ResourceLoader type '";
360 err << loader_type <<
"'.\n";
361 throw MsgException( err.str() );
375 LoaderType
const & loader_type,
376 LocatorID & locator_id
378 typedef utility::excn::EXCN_Msg_Exception MsgException;
381 LocatorTag locator_tag;
382 if ( tag->hasOption(
"locator" ) ) {
383 locator_tag = tag->getOption< LocatorTag >(
"locator" );
384 if ( ! LazyResourceManager::has_resource_locator( locator_tag ) ) {
385 std::ostringstream err;
388 <<
" with LoaderType '" << loader_type <<
"'"
389 <<
" was given the ResourceLocator tag '" << locator_tag <<
"',"
390 <<
" which has not previously been declared.";
391 throw MsgException( err.str() );
393 if( tag->hasOption(
"file" ) && locator_tag !=
"FileSystemResourceLocator" ){
394 std::ostringstream err;
396 <<
"Resource subtag "
397 <<
"with LoaderType '" << loader_type <<
"'"
398 <<
" has locator='" << locator_tag <<
"' and "
399 <<
" file='" << tag->getOption< LocatorID > (
"file") <<
"'."
400 <<
" But specifying a file is only compatible with the"
401 <<
" FileSystemResourceLocator." << std::endl;
402 throw MsgException(err.str());
404 if( locator_tag ==
"NULL" ){
412 if(tag->hasOption(
"file" )){
413 if(tag->hasOption(
"locatorID")) {
414 std::ostringstream err;
417 <<
" with LoaderType '" << loader_type <<
"'"
419 <<
" file='" << tag->getOption< LocatorID >(
"file") <<
"' and"
420 <<
" locatorID='" << tag->getOption< LocatorID >(
"locatorID") <<
"'"
421 <<
" but it is only allowed to have one." << std::endl;
422 throw MsgException(err.str());
424 locator_id = tag->getOption< LocatorID >(
"file");
425 }
else if( tag->hasOption(
"locatorID")){
426 locator_id = tag->getOption< LocatorID >(
"locatorID" );
428 std::ostringstream err;
431 <<
" with LoaderType '" << loader_type <<
"' was not supplied"
432 <<
" with a locatorID tag, which is required." << std::endl;
433 throw MsgException( err.str() );
443 LoaderType
const & loader_type,
444 ResourceTag
const & resource_tag
446 typedef utility::excn::EXCN_Msg_Exception MsgException;
450 ResourceOptionsTag resource_options_tag;
451 if ( tag->hasOption(
"options" ) ) {
452 resource_options_tag = tag->getOption< ResourceOptionsTag >(
"options" );
453 if ( ! LazyResourceManager::has_resource_options( resource_options_tag ) ) {
454 std::ostringstream err;
455 err <<
"Resource '" << resource_tag <<
"' with LoaderType '" << loader_type <<
"' was given the tag ";
456 err <<
"for a ResourceLoaderOptions, '" << resource_options_tag <<
"', which has not previously been declared.";
457 throw MsgException( err.str() );
460 return resource_options_tag;
469 for ( Tag::tags_t::const_iterator
470 tag_iter = tags->getTags().begin(),
471 tag_iter_end = tags->getTags().end();
472 tag_iter != tag_iter_end; ++tag_iter ) {
474 LoaderType loader_type((*tag_iter)->getName());
475 if( loader_type ==
"ResourceTable" ){
482 LocatorID locator_id;
483 LocatorTag locator_tag(
485 *tag_iter, loader_type, locator_id));
487 ResourceTag resource_tag(
491 ResourceOptionsTag resource_options_tag(
494 ResourceConfiguration resource_configuration;
495 resource_configuration.loader_type = loader_type;
496 resource_configuration.resource_tag = resource_tag;
497 resource_configuration.locator_tag = locator_tag;
498 resource_configuration.locator_id = locator_id;
499 resource_configuration.resource_options_tag = resource_options_tag;
501 LazyResourceManager::add_resource_configuration(
502 resource_tag, resource_configuration );
511 using namespace basic::database;
513 utility::sql_database::sessionOP db_session = parse_database_connection(tag);
516 if(tag->hasOption(
"sql_command")){
517 sql_command = tag->getOption<
string>(
"sql_command");
518 check_statement_sanity(sql_command);
520 stringstream err_msg;
522 <<
"The ResourceTable tag requires a 'sql_command' tag that "
523 <<
"is an SQL SELECT statement that returns the following columns:" << endl
524 <<
"\tresource_tag" << endl
525 <<
"\tlocator_tag" << endl
526 <<
"\tlocator_id" << endl
527 <<
"\tloader_type" << endl
528 <<
"\toptions_tag" << endl;
529 throw utility::excn::EXCN_Msg_Exception(err_msg.str());
532 cppdb::statement select_stmt(safely_prepare_statement(sql_command, db_session));
533 cppdb::result res(safely_read_from_database(select_stmt));
536 stringstream err_msg;
538 <<
"The ResourceTable tag requires a 'sql_command' tag that "
539 <<
"is an SQL SELECT statement that returns the following columns:" << endl
540 <<
"\tresource_tag" << endl
541 <<
"\tlocator_tag" << endl
542 <<
"\tlocator_id" << endl
543 <<
"\tloader_type" << endl
544 <<
"\tresource_options_tag" << endl
545 <<
"Instead, the query returned " << res.cols() <<
":" << endl
546 << sql_command << endl;
547 throw utility::excn::EXCN_Msg_Exception(err_msg.str());
554 ResourceTag resource_tag;
555 LocatorTag locator_tag;
556 LocatorID locator_id;
557 LoaderType loader_type;
558 ResourceOptionsTag resource_options_tag;
563 res >> resource_options_tag;
565 if(!LazyResourceManager::has_resource_locator(locator_tag)){
566 std::stringstream err;
568 <<
"Row " << row_number <<
" in the ResourceTable "
569 <<
"has an unrecognized locator_tag: '" << locator_tag <<
"' " << endl
570 <<
"locator_tag, locator_id, loader_type, resource_options_tag" << endl
571 <<
"'" << locator_tag <<
", '" << locator_id <<
"', '" << loader_type <<
"', '" << resource_options_tag <<
"'" << endl
572 <<
"SQL comand: " << endl
574 throw utility::excn::EXCN_Msg_Exception( err.str() );
579 if(!resource_options_tag.empty() && !LazyResourceManager::has_resource_options(resource_options_tag)){
580 std::stringstream err;
582 <<
"Row " << row_number <<
"in the ResourceTable "
583 <<
"has an unrecognized resource_options_tag: '" << resource_options_tag <<
"' " << endl
584 <<
"locator_tag\tlocator_id\tloader_type\tresource_options_tag" << endl
585 << locator_tag <<
"\t" << locator_id <<
"\t" << loader_type <<
"\t" << resource_options_tag << endl
586 <<
"SQL comand: " << endl
588 throw utility::excn::EXCN_Msg_Exception( err.str() );
591 ResourceConfiguration resource_configuration;
592 resource_configuration.loader_type = loader_type;
593 resource_configuration.resource_tag = resource_tag;
594 resource_configuration.locator_tag = locator_tag;
595 resource_configuration.locator_id = locator_id;
596 resource_configuration.resource_options_tag = resource_options_tag;
598 LazyResourceManager::add_resource_configuration(
599 resource_tag, resource_configuration );
603 TR.Warning <<
"ResourceTable returned no rows." << endl;
612 dynamic_cast< JD2ResourceManager * > ( ResourceManager::get_instance() ));
613 if ( ! jd2_resource_manager ) {
614 std::ostringstream err;
616 <<
"Error trying to access the JD2ResourceManager "
617 <<
"from the JD2ResourceManagerJobInputer";
618 EXCN_Msg_Exception( err.str() );
620 return jd2_resource_manager;
625 ResourceDescription
const & resource_description
627 using basic::resource_manager::FallbackConfigurationFactory;
628 using basic::resource_manager::FallbackConfigurationOP;
629 using basic::resource_manager::ResourceTag;
631 if ( has_resource_tag_by_job_tag(
632 resource_description,
643 if ( FallbackConfigurationFactory::get_instance()->has_fallback_for_resource( resource_description )) {
644 FallbackConfigurationOP fallback = FallbackConfigurationFactory::get_instance()->create_fallback_configuration( resource_description );
645 return fallback->fallback_specified( resource_description );
652 ResourceDescription
const & resource_description
656 if ( has_resource_tag_by_job_tag( resource_description, jobtag ) ) {
657 return get_resource_by_job_tag( resource_description, jobtag);
660 std::map< std::string, std::string >::const_iterator fallbackname_iterator
664 return find_resource( fallbackname_iterator->second );
666 using basic::resource_manager::FallbackConfigurationFactory;
667 using basic::resource_manager::FallbackConfigurationOP;
669 if ( FallbackConfigurationFactory::get_instance()->has_fallback_for_resource( resource_description )) {
670 FallbackConfigurationOP fallback = FallbackConfigurationFactory::get_instance()->create_fallback_configuration( resource_description );
671 if ( fallback->fallback_specified( resource_description ) ) {
674 std::string fallbackname =
"fallback_" + resource_description;
675 for (
core::Size ii = 1; ii <= 10000; ++ii ) {
676 if ( ! has_resource_configuration( fallbackname ))
break;
677 fallbackname =
"fallback_" + resource_description +
"_" + utility::to_string( numeric::random::random_range(1,4000000) );
679 if ( has_resource_configuration( fallbackname ) ) {
680 throw utility::excn::EXCN_Msg_Exception(
"Could not name the fallback resource after 10000 attempts. Try not to name your resources"
681 " beginning with the prefix 'fallback_'." );
683 basic::resource_manager::ResourceConfiguration fake_configuration;
684 fake_configuration.resource_tag = fallbackname;
685 add_resource_configuration( fallbackname, fake_configuration );
687 add_resource( fallbackname, fallbackresource );
688 return fallbackresource;
692 std::ostringstream errmsg;
693 errmsg <<
"JD2ResourceManager does not have a resource "
694 "corresponding to the resource description '" + resource_description +
"'. for job '" +
696 errmsg <<
"Resources may be specified on the command line or through the JD2ResourceManagerJobInputter resource-declaration file.\n";
698 if ( FallbackConfigurationFactory::get_instance()->has_fallback_for_resource( resource_description ) ) {
701 errmsg <<
"The FallbackConfiguration for this resource description gives this error:\n";
702 FallbackConfigurationOP fallback = FallbackConfigurationFactory::get_instance()->create_fallback_configuration( resource_description );
703 errmsg << fallback->could_not_create_resource_error_message( resource_description ) <<
"\n";
705 errmsg <<
"This resource description does not have a FallbackConfiguration defined.\n";
708 errmsg <<
"Thrown from JD2ResourceManager::get_resource\n";
709 throw utility::excn::EXCN_Msg_Exception( errmsg.str() );
716 utility::options::BooleanOptionKey key
719 if ( has_job_options( currjob.
input_tag() ) ) {
720 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
721 if(job_option->has_option(key)){
722 return job_option->get_option(key);
725 return basic::options::option[ key ]();
730 utility::options::BooleanVectorOptionKey key
733 if ( has_job_options( currjob.
input_tag() ) ) {
734 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
735 if(job_option->has_option(key)){
736 return job_option->get_option(key);
739 return basic::options::option[ key ]();
744 utility::options::FileOptionKey key
747 if ( has_job_options( currjob.
input_tag() ) ) {
748 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
749 if(job_option->has_option(key)){
750 return job_option->get_option(key);
753 return basic::options::option[ key ]();
758 utility::options::FileVectorOptionKey key
761 if ( has_job_options( currjob.
input_tag() ) ) {
762 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
763 if(job_option->has_option(key)){
764 return job_option->get_option(key);
767 return basic::options::option[ key ]();
772 utility::options::IntegerOptionKey key
775 if ( has_job_options( currjob.
input_tag() ) ) {
776 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
777 if(job_option->has_option(key)){
778 return job_option->get_option(key);
781 return basic::options::option[ key ]();
786 utility::options::IntegerVectorOptionKey key
789 if ( has_job_options( currjob.
input_tag() ) ) {
790 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
791 if(job_option->has_option(key)){
792 return job_option->get_option(key);
795 return basic::options::option[ key ]();
798 utility::file::PathName
const &
800 utility::options::PathOptionKey key
803 if ( has_job_options( currjob.
input_tag() ) ) {
804 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
805 if(job_option->has_option(key)){
806 return job_option->get_option(key);
809 return basic::options::option[ key ]();
814 utility::options::PathVectorOptionKey key
817 if ( has_job_options( currjob.
input_tag() ) ) {
818 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
819 if(job_option->has_option(key)){
820 return job_option->get_option(key);
823 return basic::options::option[ key ]();
828 utility::options::RealOptionKey key
831 if ( has_job_options( currjob.
input_tag() ) ) {
832 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
833 if(job_option->has_option(key)){
834 return job_option->get_option(key);
837 return basic::options::option[ key ]();
842 utility::options::RealVectorOptionKey key
845 if ( has_job_options( currjob.
input_tag() ) ) {
846 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
847 if(job_option->has_option(key)){
848 return job_option->get_option(key);
851 return basic::options::option[ key ]();
856 utility::options::StringOptionKey key
859 if ( has_job_options( currjob.
input_tag() ) ) {
860 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
861 if(job_option->has_option(key)){
862 return job_option->get_option(key);
865 return basic::options::option[ key ]();
870 utility::options::StringVectorOptionKey key
873 if ( has_job_options( currjob.
input_tag() ) ) {
874 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
875 if(job_option->has_option(key)){
876 return job_option->get_option(key);
879 return basic::options::option[ key ]();
884 utility::options::BooleanOptionKey key
888 JobOptionsOP job_option(
891 return job_option->has_option(key);
896 utility::options::BooleanVectorOptionKey key
899 if ( ! has_job_options( currjob.
input_tag() ) ) {
return false; }
900 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
901 return job_option->has_option(key);
906 utility::options::FileOptionKey key
909 if ( ! has_job_options( currjob.
input_tag() ) ) {
return false; }
910 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
911 return job_option->has_option(key);
916 utility::options::FileVectorOptionKey key
919 if ( ! has_job_options( currjob.
input_tag() ) ) {
return false; }
920 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
921 return job_option->has_option(key);
926 utility::options::IntegerOptionKey key
929 if ( ! has_job_options( currjob.
input_tag() ) ) {
return false; }
930 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
931 return job_option->has_option(key);
936 utility::options::IntegerVectorOptionKey key
939 if ( ! has_job_options( currjob.
input_tag() ) ) {
return false; }
940 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
941 return job_option->has_option(key);
946 utility::options::PathOptionKey key
949 if ( ! has_job_options( currjob.
input_tag() ) ) {
return false; }
950 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
951 return job_option->has_option(key);
956 utility::options::PathVectorOptionKey key
959 if ( ! has_job_options( currjob.
input_tag() ) ) {
return false; }
960 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
961 return job_option->has_option(key);
966 utility::options::RealOptionKey key
969 if ( ! has_job_options( currjob.
input_tag() ) ) {
return false; }
970 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
971 return job_option->has_option(key);
976 utility::options::RealVectorOptionKey key
979 if ( ! has_job_options( currjob.
input_tag() ) ) {
return false; }
980 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
981 return job_option->has_option(key);
986 utility::options::StringOptionKey key
989 if ( ! has_job_options( currjob.
input_tag() ) ) {
return false; }
990 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
991 return job_option->has_option(key);
996 utility::options::StringVectorOptionKey key
999 if ( ! has_job_options( currjob.
input_tag() ) ) {
return false; }
1000 JobOptionsOP job_option( get_job_options( currjob.
input_tag() ));
1001 return job_option->has_option(key);
1004 basic::resource_manager::ResourceOP
1006 basic::resource_manager::FallbackConfigurationCOP fallback,
1007 ResourceDescription
const & resource_description
1010 using namespace basic::resource_manager;
1013 ResourceLocatorOP locator(find_resource_locator(
""));
1015 ResourceStreamOP stream( locator->locate_resource_stream(
1016 fallback->get_locator_id(resource_description) ));
1018 ResourceLoaderOP loader(
1019 ResourceLoaderFactory::get_instance()->create_resource_loader(
1020 fallback->get_resource_loader( resource_description )));
1022 ResourceOptionsOP resource_options = fallback->get_resource_options( resource_description );
1023 if ( resource_options == 0 ) {
1024 resource_options = loader->default_options();
1027 return loader->create_resource( *resource_options, fallback->get_locator_id( resource_description ), stream->stream());