std::shared_ptr<unity_sgraph_base> unity_sgraph::lambda_triple_apply_native(const function_closure_info& toolkit_fn_name, const std::vector<std::string>& mutated_fields) { auto native_execute_function = get_unity_global_singleton() ->get_toolkit_function_registry() ->get_native_function(toolkit_fn_name); log_func_entry(); auto lambda = [=](edge_triple& args)->void { std::vector<variant_type> var(3); var[0] = to_variant(_map_to_flex_dict(std::move(args.source))); var[1] = to_variant(_map_to_flex_dict(std::move(args.edge))); var[2] = to_variant(_map_to_flex_dict(std::move(args.target))); variant_type ret = native_execute_function(var); var = variant_get_value<std::vector<variant_type>>(ret); args.source = _map_from_flex_dict(variant_get_value<flexible_type>(var[0])); args.edge = _map_from_flex_dict(variant_get_value<flexible_type>(var[1])); args.target = _map_from_flex_dict(variant_get_value<flexible_type>(var[2])); }; return lambda_triple_apply_native(lambda, mutated_fields); }
void unity_server::start(const unity_server_initializer& server_initializer) { // log files if (!options.log_file.empty()) { if (options.log_rotation_interval) { graphlab::begin_log_rotation(options.log_file, options.log_rotation_interval, options.log_rotation_truncate); } else { global_logger().set_log_file(options.log_file); } } graphlab::configure_global_environment(options.root_path); graphlab::global_startup::get_instance().perform_startup(); // server address options.server_address = parse_server_address(options.server_address); // construct the server server = new cppipc::comm_server(std::vector<std::string>(), "", options.server_address, options.control_address, options.publish_address, options.secret_key); set_log_progress(true); // initialize built-in data structures, toolkits and models, defined in unity_server_init.cpp server_initializer.init_toolkits(*toolkit_functions); server_initializer.init_models(*toolkit_classes); create_unity_global_singleton(toolkit_functions, toolkit_classes, server); auto unity_global_ptr = get_unity_global_singleton(); server_initializer.register_base_classes(server, unity_global_ptr); // initialize extension modules and lambda workers server_initializer.init_extensions(options.root_path, unity_global_ptr); lambda::set_pylambda_worker_binary_from_environment_variables(); // start the cppipc server server->start(); logstream(LOG_EMPH) << "Unity server listening on: " << options.server_address << std::endl; logstream(LOG_EMPH) << "Total System Memory Detected: " << total_mem() << std::endl; }