-
Notifications
You must be signed in to change notification settings - Fork 22
/
cf_fetcher_worker
executable file
·40 lines (33 loc) · 1.02 KB
/
cf_fetcher_worker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/lib";
use lib "$FindBin::Bin/extlib/lib/perl5";
use local::lib "$FindBin::Bin/extlib";
use lib "$FindBin::Bin/site-lib";
use CloudForecast::Gearman::Worker;
use Getopt::Long;
my $root_dir = $FindBin::Bin;
my $config_yaml = $root_dir . '/cloudforecast.yaml';
my $max_workers = 4;
my $max_requests_per_child = 100;
my $max_execution_time = 60;
my $restarter = 0;
GetOptions(
'c|config=s' => \$config_yaml,
'r|restarter' => \$restarter,
'max-workers=i' => \$max_workers,
'max-request-per-child=i' => \$max_requests_per_child,
'max-exection-time=i' => \$max_execution_time,
);
die 'config not found' unless $config_yaml;
my $gearman = CloudForecast::Gearman::Worker->new({
root_dir => $root_dir,
global_config => $config_yaml,
restarter => $restarter,
max_workers => $max_workers,
max_requests_per_child => $max_requests_per_child,
max_execution_time => $max_execution_time,
});
$gearman->fetcher_worker();