Builds a new datamanager from a config file and a tuple of tuples of arguments.
The latter are supplemented by the arguments given by the config, and then passed to the writetask factory, each. The result is then used for creating the datamanager. The arguments that need to be supplied in the code are
681 {
682
683 const auto _log = spdlog::get("data_mngr");
684
685 if constexpr (sizeof...(Args) == 0)
686 {
687 _log->info("Empty argument tuple for DataManager factory, "
688 "building default ...");
689 return Default::DefaultDataManager< Model >{};
690 }
691 else
692 {
693
694
695 std::map< std::string, Config >
tasknodes;
697 {
698 _log->info("Name of current task: {}",
699 node.first.as< std::string >());
700
702 }
703
704
705
706 std::unordered_map<
707 std::string,
708 std::shared_ptr< Default::DefaultWriteTask< Model > > >
710
711 boost::hana::for_each(
713
714
715
716
717
718
720 using std::get;
721 std::string name = "";
724
725
727 {
729 }
730 else
731 {
732
733 throw std::invalid_argument(
735 "' was not found in the config!");
736 }
737
738
741 {
743 }
744 else
745 {
747 }
748
749
750
752 boost::hana::remove_at(
arg_tpl,
753 boost::hana::size_t< 0 >{}),
755 return boost::hana::type_c<
756 std::decay_t<
decltype(
t) > >;
757 });
758
760 decltype(boost::hana::unpack(
762 boost::hana::template_<
763 _DMUtils::all_callable >))::type::value;
764
765
767 {
768 _log->info("Building write task '{}' via factory ...",
769 name);
771 }
772
773 else
774 {
775
776
778
780
783
784 DatasetDescriptor{
785 get_as< std::string >("dataset_path",
786 tasknode_iter->second),
787 (tasknode_iter->second["capacity"]
788 ? get_as< std::vector< hsize_t > >(
789 "capacity", tasknode_iter->second)
790 : std::vector< hsize_t >{}),
795 (tasknode_iter->second["compression"]
796 ? get_as< int >("compression",
797 tasknode_iter->second)
798 : 0) });
799
800
801
802 auto full_arg_tpl = std::tuple_cat(
803 config_args,
804 boost::hana::remove_at(arg_tpl,
805 boost::hana::size_t< 0 >{}));
806
807 _log->info("Building write task '{}' via factory ...",
808 name);
809
810 tasks.emplace(_call_taskfactory(typetag, full_arg_tpl));
811 }
812 });
813
814 _log->info("Forwarding arguments to DataManager constructor ...");
815
816
817
818 return Default::DefaultDataManager< Model >(
819 conf,
820 tasks,
821 deciderfactories,
822 triggerfactories,
823 Default::DefaultExecutionProcess());
824 }
825 }
std::pair< std::string, std::shared_ptr< Default::DefaultWriteTask< Model > > > _call_taskfactory(std::string typetag, ArgTpl &&arg_tpl)
Function which calls the taskfactory with argument tuples, and takes care of using the correct type-t...
Definition factory.hh:614
Definition parallel.hh:235