Friday, November 24, 2006

KMASGE

KMASGE (KMA Sun Grid Engine) is the render manager at KMA. It uses Sun Grid Engine for the distribution.

Thanks to the XML status output from SGE 6.0 i have been able to build a SKAPPS integrated GUI using Apache-Php this interface is called KMASGE-MON.

Recently there have also been added Job-log/Job-Statistics. The statistics is not using the SGE Accounting. But instead uses a custom MySql based accounting.











For job submission, we use an interface called RK (Render King). Render king is kind of different from any job-submit interfaces i have seen. It is integrated into the SKAPPS Sequence and Shot DB and relies on the KSF (KMA Submit File) system witch gives it a number of advantages. I will try to demo the workflow for you ASAP.

The Socket Server













One of the elements that makes it possible for SKAPPS to be based on an Apache-PHP based system. Is the submitserver.py script. When this script is executed it opens a Socket on port 8081, typically on a user workstation at login. It directs any input on this port directly to a system command. A major security hole, yes i know, but who cares we are in an closed environment.

submitserver.py
----------------------------------------------------------------------------------
#!/usr/bin/env python
import socket
import os
print "-------------------------------------"
print " KMA Submitserver"
print " (Do not close this window!!!!)"
print "-------------------------------------"
port = 8081
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Accept UDP datagrams, on the given port, from any sender
s.bind(("", port))
print "waiting on port:", port
while 1:
# Receive up to 1,024 bytes in a datagram
data, addr = s.recvfrom(1024)
print "Received:", data, "from", addr
os.system(data + " &")

----------------------------------------------------------------------------------
So by creating a php socket client. We can now send system commands to the users workstation executede by this user.
----------------------------------------------------------------------------------
function shellSocketCmd($address,$command){
$service_port = 8081;
//create cocket connection
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
$result = socket_connect($socket, $address, $service_port);
//write command to socket
socket_write($socket, $command, strlen($command));
//close socket
socket_close($socket);
}

----------------------------------------------------------------------------------
You can get the client ip by using the $REMOTE_ADDR variable.

This trick also works with the maya command port. Allowing you to send mel commands directly to maya from you php functions.
----------------------------------------------------------------------------------
function mayaSocketCmd($address,$command){
$service_port = 8086;
//create cocket connection
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$result = socket_connect($socket, $address, $service_port);
//write command to socket
socket_write($socket, $command, strlen($command));
//close socket
socket_close($socket);
}

----------------------------------------------------------------------------------

Thursday, November 23, 2006

Skapps introduction

SKAPPS ( Shottrack KMA Production Pipeline System ) Its a crazy title but it covers the functions of the software pretty well. SKAPPS is the heart of our production pipeline at KMA, we aim to chain as Much of our production software as possible to this system and vice versa.

SKAPPS is build using PHP ,MySql, Python and a bit of BASH. The philosophy of the development process is the philosophy of rapid application development. Since SKAPPS is in house software its always in a state of development we test the software as we go along..

SKAPPS is first and foremost an dateBase of Projects , Sequence and shots, Libraries and Lib-items. Along the way many other function has found its way into this system .











A Typical screen from the SKAPPS system.


Skapps consistes at the moment of 7 main modules. Each module have an collection of functions. I will try to make a list of them below.

1. The project browser
2. Asset browser
3. Project statistics
4. Render King
5 KMASGE MON ( Kma Sge Monitor)
6. Designs browser
7. User manager