#---------------------------------------------------------------
# ____                   _ _         ____  _
#|  _ \ ___  _   _  __ _| | |_ _   _/ ___|| |__   __ _ _ __ ___
#| |_) / _ \| | | |/ _` | | __| | | \___ \| '_ \ / _` | '__/ _ \
#|  _ < (_) | |_| | (_| | | |_| |_| |___) | | | | (_| | | |  __/
#|_| \_\___/ \__, |\__,_|_|\__|\__, |____/|_| |_|\__,_|_|  \___|
#            |___/             |___/
#
# Copyright (C) 2008 RoyaltyShare, Inc.      All Rights Reserved
#---------------------------------------------------------------
package Job::Scheduler::Windows;

use strict;
use warnings;

use Date::Calc;

use lib '/app/tools/common/lib';
use lib '/app/tools/job/lib/';
use Common::Log;
use Common::Util;
use Common::Assert;
use Job::Scheduler;

use base 'Job::Scheduler';

sub wrapperPath {
    Common::RSApp::GetConfig( job => 'windows_job_wrapper_path' );
}

sub _launchJob {
    my ( $self, $jobID ) = @_;

    # Now use the wrapper script to invoke this job.
    #
    die "CONFIG ERROR - missing wrapper path" unless defined $self->wrapperPath();

    my $execString = $self->wrapperPath() . " -j $jobID";
    $self->report( "execing $execString", 2 );

    # Fire off a background process to run the job wrapper
    # Because we are not setting the 'die_upon_destroy' flag, we
    # can let the reference to the process go out of scope and the
    # process will keep running.
    #
    my $newProc = Proc::Background->new($execString);
    die "ERROR - unable to launch background process" unless $newProc;
}

sub _fetchLoadAverage {
    my ($self) = @_;

    my ( $currentLoad, $fiveMinLoad, $fifteenMinLoad );
    return ( $currentLoad, $fiveMinLoad, $fifteenMinLoad );
}

1;
