Gearman-Driver
view release on metacpan or search on metacpan
Example:
my $driver = Gearman::Driver->new(
namespaces => [qw(My::Workers)],
worker_options => {
'GLOBAL' => {
'config' => $config,
},
'My::Workers::MysqlPing' => {
'dsn' => 'DBI:mysql:database=test;host=localhost;mysql_auto_reconnect=1;mysql_enable_utf8=1;mysql_server_prepare=1;',
},
'My::Workers::ImageThumbnail' => {
'default_format' => 'jpeg',
'default_size => ' 133 x 100 ',
}
}
);
You should define these in a runtime config (See also "configfile"),
might be:
---
worker_options:
'My::App::Worker::MysqlPing':
'dsn': 'DBI:mysql:database=test;host=localhost;mysql_auto_reconnect=1;mysql_enable_utf8=1;mysql_server_prepare=1;'
'user': 'root'
'password:': ''
'My::App::Worker::ImageThumbnail':
'default_format': 'jpeg'
'default_size': '133x100'
Job runtime attributes
You can override a job attribute by its name here. This help to tuning
job some runtime-related options (like max_processes, min_processes)
handy. You just change the options in a config file, no need to modify
lib/Gearman/Driver.pm view on Meta::CPAN
Example:
my $driver = Gearman::Driver->new(
namespaces => [qw(My::Workers)],
worker_options => {
'GLOBAL' => {
'config' => $config,
},
'My::Workers::MysqlPing' => {
'dsn' => 'DBI:mysql:database=test;host=localhost;mysql_auto_reconnect=1;mysql_enable_utf8=1;mysql_server_prepare=1;',
},
'My::Workers::ImageThumbnail' => {
'default_format' => 'jpeg',
'default_size => ' 133 x 100 ',
}
}
);
You should define these in a runtime config (See also L</configfile>), might be:
---
worker_options:
'My::App::Worker::MysqlPing':
'dsn': 'DBI:mysql:database=test;host=localhost;mysql_auto_reconnect=1;mysql_enable_utf8=1;mysql_server_prepare=1;'
'user': 'root'
'password:': ''
'My::App::Worker::ImageThumbnail':
'default_format': 'jpeg'
'default_size': '133x100'
=cut
has 'worker_options' => (
isa => 'HashRef',
( run in 0.248 second using v1.01-cache-2.11-cpan-00829025b61 )