Vowpal Wabbit
Functions
sender.h File Reference

Go to the source code of this file.

Functions

LEARNER::base_learnersender_setup (VW::config::options_i &options, vw &all)
 

Function Documentation

◆ sender_setup()

LEARNER::base_learner* sender_setup ( VW::config::options_i options,
vw all 
)

Definition at line 100 of file sender.cc.

References VW::config::option_group_definition::add(), VW::config::options_i::add_and_parse(), end_examples(), VW::finish_example(), LEARNER::init_learner(), learn(), LEARNER::make_base(), VW::config::make_option(), open_sockets(), vw::p, parser::ring_size, and VW::config::options_i::was_supplied().

Referenced by parse_reductions().

101 {
102  std::string host;
103 
104  option_group_definition sender_options("Network sending");
105  sender_options.add(make_option("sendto", host).keep().help("send examples to <host>"));
106  options.add_and_parse(sender_options);
107 
108  if (!options.was_supplied("sendto"))
109  {
110  return nullptr;
111  }
112 
113  auto s = scoped_calloc_or_throw<sender>();
114  s->sd = -1;
115  open_sockets(*s.get(), host);
116 
117  s->all = &all;
118  s->delay_ring = calloc_or_throw<example*>(all.p->ring_size);
119 
121  l.set_finish_example(finish_example);
122  l.set_end_examples(end_examples);
123  return make_base(l);
124 }
void open_sockets(sender &s, std::string host)
Definition: sender.cc:44
base_learner * make_base(learner< T, E > &base)
Definition: learner.h:462
virtual void add_and_parse(const option_group_definition &group)=0
void finish_example(vw &, sender &, example &)
Definition: sender.cc:91
parser * p
Definition: global_data.h:377
learner< T, E > & init_learner(free_ptr< T > &dat, L *base, void(*learn)(T &, L &, E &), void(*predict)(T &, L &, E &), size_t ws, prediction_type::prediction_type_t pred_type)
Definition: learner.h:369
void learn(sender &s, LEARNER::single_learner &, example &ec)
Definition: sender.cc:79
virtual bool was_supplied(const std::string &key)=0
const size_t ring_size
Definition: parser.h:80
typed_option< T > make_option(std::string name, T &location)
Definition: options.h:80
void end_examples(sender &s)
Definition: sender.cc:93