14 Commits

Author SHA1 Message Date
a3e58e4ee4 Merge branch 'master' of git+ssh://git.sihnon.net/home/git/public/handbrake-cluster-webui 2011-06-28 20:11:50 +01:00
3b22b0f2c9 Bug fix: Undefined index $values[9]
RippingCluster_LogEntry overwrote base class field list, causing
undefined index notices when the base class was explicitly used.
2011-06-28 20:06:24 +01:00
efb7db35d8 Fixed typo in _inc.php 2011-06-20 22:33:18 +01:00
841a5b9f92 Revert previous untested change in include statements 2011-06-20 22:04:44 +01:00
506a6e189c Update paths for packaging 2011-06-20 19:34:27 +01:00
3da59727de Bug fix: typo in variable name 2011-06-20 19:29:11 +01:00
c0d8747b21 Update init script to background the worker process 2011-06-19 22:48:45 +01:00
e1bd324e84 Bugfix: error in client log call 2011-06-19 00:13:39 +01:00
8fe8f8ba08 Use defines for library paths 2011-06-18 23:53:25 +01:00
274bc8f3c9 Use defines for library paths 2011-06-18 22:15:36 +01:00
edc2439232 Make worker read configuration from /etc/ripping-cluster 2011-06-18 18:36:33 +01:00
bd74b0f54e Update default config files 2011-06-18 18:35:40 +01:00
cd93f13f41 Add gentoo init script 2011-06-18 18:30:03 +01:00
21bd423f02 Rename worker file 2011-06-18 17:45:20 +01:00
7 changed files with 125 additions and 20 deletions

View File

@@ -0,0 +1,29 @@
#!/sbin/runscript
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
PID_FILE="/var/run/ripping-cluster-worker.pid"
depend() {
need localmount net
use dns logger puppetmaster netmount nfsmount
}
start() {
ebegin "Starting ripping-cluster-worker"
start-stop-daemon --start --quiet \
--background --make-pidfile --pidfile ${PID_FILE} \
--exec /usr/bin/php /usr/lib/ripping-cluster/worker/ripping-cluster-worker.php
eend $? "Failed to start ripping-cluster-worker"
}
stop() {
ebegin "Stopping ripping-cluster-worker"
start-stop-daemon --stop --quiet \
--pidfile ${PID_FILE}
local ret=$?
eend ${ret} "Failed to stop puppet"
rm -f ${PID_FILE}
return ${ret}
}

View File

@@ -1,5 +1,25 @@
<?php
/**
* Sihnon Framework Library path
*
* Specifies the absolute or relative path to the Sihnon Framework library directory, relative to the webui root directory.
* Path must end with a trailing slash.
*
* @var string
*/
define('SihnonFramework_Lib', '/usr/lib/sihnon-php-lib/source/lib/');
/**
* Sihnon Library path
*
* Specifies the absolute or relative path to the Sihnon library directory, relative to the webui root directory.
* Path must end with a trailing slash.
*
* @var string
*/
define('Sihnon_Lib', '/usr/lib/ripping-cluster/source/lib/');
/**
* RippingCluster Library path
*
@@ -8,16 +28,65 @@
*
* @var string
*/
define('RippingCluster_Lib', '../lib/');
define('RippingCluster_Lib', '/usr/lib/ripping-cluster/source/lib/');
/**
* RippingCluster Database Configuration
* Sihnon Database Support
*
* Specifies whether or not to include database support in the Framework
*
* @var bool
*/
define('Sihnon_DatabaseSupport', true);
/**
* Sihnon Database Configuration
*
* Specifies the absolute or relative path to the RippingCluster database configuration file.
* Specifies the absolute or relative path to the Sihnon database configuration file, required when Database support is enabled.
* This is a standard ini type file, containing the config required to connect to the database.
*
* @var string
*/
define('RippingCluster_DBConfig', '../dbconfig.conf');
define('Sihnon_DBConfig', '/etc/ripping-cluster/dbconfig.conf');
?>
/**
* Sihnon Config Plugin
*
* Specifies the plugin to use for configuration value storage.
* Options include:
* - Database (Requires Database Support to be enabled, and the Sihnon_ConfigTable option set)
* - FlatFile (Requires the Sihnon_ConfigFile option set)
*
* @var string
*/
define('Sihnon_ConfigPlugin', 'Database');
/**
* Sihnon Config Table
*
* Specifies the name of the database table thats used for storing configuration values
* when the Database Config Plugin is used.
*
* @var string
*/
define('Sihnon_ConfigTable', 'settings');
/**
* Sihnon Config File
*
* Specifies the name of the file used to store configuration values when the FlatFile Config Plugin is used
*
* @var string
*/
define('Sihnon_ConfigFile', '/etc/ripping-cluster/settings.txt');
/**
* Sihnon Development Mode
*
* Specifies whether or not the Framework should operate in debug mode
*
* @var bool
*/
define('Sihnon_Dev', false);
?>

View File

@@ -1,5 +1,5 @@
hostname = localhost
username = handbrake
password = handbrake
dbname = handbrake_cluster
username = ripping
password = ripping
dbname = ripping_cluster

View File

@@ -4,8 +4,16 @@ class RippingCluster_LogEntry extends SihnonFramework_LogEntry {
protected $job_id;
protected static $types;
public static function initialise() {
self::$types['job_id'] = 'int';
// Copy the list of datatypes from the parent
// We can't modify it in place, else we'll break any logging done inside the SihnonFramework tree
// or other subclass trees.
static::$types = parent::$types;
// Add the new data types for this subclass
static::$types['job_id'] = 'int';
}
protected function __construct($level, $category, $ctime, $pid, $file, $line, $message, $job_id) {

View File

@@ -1,10 +1,9 @@
<?php
require_once '../private/config.php';
require_once(SihnonFramework_Lib . 'SihnonFramework/Main.class.php');
//require_once RippingCluster_Lib . 'RippingCluster/Main.class.php';
require_once '/etc/ripping-cluster/config.php';
require_once SihnonFramework_Lib . 'SihnonFramework/Main.class.php';
SihnonFramework_Main::registerAutoloadClasses('SihnonFramework', SihnonFramework_Lib,
'RippingCluster', SihnonFramework_Main::makeAbsolutePath('../source/lib/'));
'RippingCluster', RippingCluster_Lib);
?>

View File

@@ -2,12 +2,12 @@
define('HBC_File', 'run-jobs');
require_once '../private/config.php';
require_once '/etc/ripping-cluster/config.php';
require_once(SihnonFramework_Lib . 'SihnonFramework/Main.class.php');
require_once 'Net/Gearman/Client.php';
SihnonFramework_Main::registerAutoloadClasses('SihnonFramework', SihnonFramework_Lib,
'RippingCluster', SihnonFramework_Main::makeAbsolutePath('../source/lib/'));
'RippingCluster', RippingCluster_Lib);
try {
$main = RippingCluster_Main::instance();
@@ -34,7 +34,7 @@ try {
// Start the job queue
$result = $client->runSet($set);
RippingCluster_LogEntry::info($log, 'Job queue completed', 'batch');
RippingCluster_ClientLogEntry::info($log, null, 'Job queue completed', 'batch');
} catch (RippingCluster_Exception $e) {
die("Uncaught Exception (" . get_class($e) . "): " . $e->getMessage() . "\n");
@@ -55,7 +55,7 @@ function gearman_fail($task) {
$main = RippingCluster_Main::instance();
$log = $main->log();
$job = RippingCluster_Job::fromId($task->args['rip_options']['id']);
$job = RippingCluster_Job::fromId($task->arg['rip_options']['id']);
$job->updateStatus(RippingCluster_JobStatus::FAILED);
RippingCluster_ClientLogEntry::info($log, $job->id(), 'Job failed');

View File

@@ -2,13 +2,13 @@
define('HBC_File', 'worker');
require_once '../private/config.php';
require_once '/etc/ripping-cluster/config.php';
require_once(SihnonFramework_Lib . 'SihnonFramework/Main.class.php');
require_once 'Net/Gearman/Worker.php';
SihnonFramework_Main::registerAutoloadClasses('SihnonFramework', SihnonFramework_Lib,
'RippingCluster', SihnonFramework_Main::makeAbsolutePath('../source/lib/'));
SihnonFramework_Main::registerAutoloadClasses('Net', SihnonFramework_Main::makeAbsolutePath('../source/lib/'));
'RippingCluster', SihnonFramework_Main::makeAbsolutePath(RippingCluster_Lib));
SihnonFramework_Main::registerAutoloadClasses('Net', SihnonFramework_Main::makeAbsolutePath(RippingCluster_Lib));
try {