Author Topic: Time Based Jobs  (Read 4359 times)

davekoenig

  • Jr. Member
  • **
  • Posts: 4
Time Based Jobs
« on: January 17, 2008, 10:15:36 PM »
Does anyone know if there is a way to fire off a job at a certain time?  I've figured out the unlocking processors at a certain time, but can these be independent of each other?  Ie can I unlock processors at 5AM and fire off a job at 7AM?

Thanks

Dave

Scot Brew

  • Hero Member
  • *****
  • Posts: 272
    • PipelineFX
Re: Time Based Jobs
« Reply #1 on: January 18, 2008, 02:32:58 AM »
There is no direct way to do that through the GUI out of the box at this time, though it should be feasible through using the Operating System (cron on Linux and OSX, Scheduled Tasks on Windows).  The QubeGUI can be used to save off a set of job parameters ("save" icon in the submit dialogs or rt-click on the Job in the Job List) and then launch it from the command-line with qbsub.

Steps:
  • In the QubeGUI, use the Submit->____ menu item to bring up a dialog
  • Fill in the dialog parameters
  • Click on the "Save" icon at the bottom left in the dialog and save it to a file
  • "Cancel" the "submit" dialog
  • From the commandline (through cron or Scheduled Tasks) Use qbsub --import <filename.xja> to submit the job

Scot Brew

  • Hero Member
  • *****
  • Posts: 272
    • PipelineFX
Re: Time Based Jobs
« Reply #2 on: January 18, 2008, 02:35:30 AM »
If tighter integration and simplified usability for the artists is desired, the QubeGUI python scripts can also be customized at your studio to add this workflow functionality directly into the GUI.

davekoenig

  • Jr. Member
  • **
  • Posts: 4
Re: Time Based Jobs
« Reply #3 on: January 18, 2008, 07:43:21 PM »
Awesome, thanks for the response.  I was hoping to avoid using the TaskScheduler if possible.

I'll look into modifying the Python scripts.

Dave

michael.graf

  • Sr. Member
  • ****
  • Posts: 26
Re: Time Based Jobs
« Reply #4 on: March 06, 2008, 11:57:17 PM »
i use callbacks to create jobs that are specified as Nightjobs with start and end times.  So a night job is submitted as blocked, unblocks itself at 7pm and pending until 5am.  At 5am if the job is still pending, it blocks itself.  If it is running, it is allowed to finish.

might as well show my hardwork, hehe
my entire job submission is done using a custom perl script and qube perl api, i do not use the qube gui for job submission.

in general, setting up the callback

use Time::Local;

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); # Grabs current local time
my $qubetimeepoch = timelocal(0,0,0,1,0,2000);  # Sets Qube Time Epoch shift

# Night callback
my $onedayrepeat = 24*60*60;
my $nightbegin = timelocal(0, 0, 19, $mday, $mon, $year) - $qubetimeepoch;  # Set Night start to 7:00pm
my $nightend = timelocal(0, 0, 5, $mday, $mon, $year) + $onedayrepeat - $qubetimeepoch;   # Set Night reblock time 5:00am
my $cbnightbegin =  {
                    "triggers" => "dummy-repeat-$job_label_slave-$nightbegin-$onedayrepeat or dummy-time-$job_label_slave-$nightbegin and not running-job-$job_label_slave and not done-job-$job_label_slave and not killed-job-$job_label_slave",
                    "language" => "qube",
                    "code" => "unblock-self"
                    };
my $cbnightend =    {
                    "triggers" => "dummy-repeat-$job_label_slave-$nightend-$onedayrepeat or dummy-time-$job_label_slave-$nightend and not running-job-$job_label_slave and not done-job-$job_label_slave and not killed-job-$job_label_slave",
                    "language" => "qube",
                    "code" => "block-self"
                    };
# Program Conditional Callbacks here....

    if (defined $night and length($night))
    {
        push(@job_callbacks, $cbnightbegin);
        push(@job_callbacks, $cbnightend);
    }

# End Program Conditional Callbacks

    $job->{callbacks} = [ @job_callbacks ];
   


I still can no believe Pipelinefx has not published this in the FAQ.  I worked for a few days figuring this out, the qube epoch is critical.