It’s not a bug but would it be possible for the deadlineHarmonyClient.js to support linux?
How odd! The official Toonboom website only provide downloads for Windows and OS X for Harmony, yet clearly they have docs for a Linux version?!
docs.toonboom.com/help/harmony/# … Linux.html
I’ll get this logged internally to see if we can support this platform as well for you.
Here’s where I am now. I’ve added a else if for Linux.
I’ve also modify the Client .js
But i’m getting an error " unable to loadscript file /SubmitHarmonyToDeadline.js "
HarmonyIniFilename = "";
function callDeadlineCommand( args )
{
var commandLine = "";
//On OSX, we look for the DEADLINE_PATH file. On other platforms, we use the environment variable.
if (System.osName == "MacOS")
{
var file = new File( "/Users/Shared/Thinkbox/DEADLINE_PATH" );
file.open(FileAccess.ReadOnly);
deadlineBin = file.read();
file.close();
deadlineBin = trim(deadlineBin);
commandLine = "\"" + deadlineBin + "/deadlinecommand\" ";
}
else if (System.osName == "Linux")
{
deadlineBin = System.getenv( "DEADLINE_PATH" );
deadlineBin = trim(deadlineBin);
commandLine = "\"" + deadlineBin + "/deadlinecommand\" ";
}
else
{
deadlineBin = System.getenv( "DEADLINE_PATH" );
deadlineBin = trim(deadlineBin);
commandLine = "\"" + deadlineBin + "\\deadlinecommand.exe\" ";
}
commandArgs = [];
commandArgIndex = 0;
commandArgs[commandArgIndex++] = commandLine;
for( arg in args)
{
commandArgs[commandArgIndex++] = args[arg];
}
var status = Process.execute(commandArgs);
var mOut = Process.stdout;
var result = mOut;
return result;
}
function trim(string)
{
return string
.replace( "\n","" )
.replace( "\r", "" )
.replace( "^\s+", "" )
.replace( "\s+$");
}
function parseBool( value )
{
value = value.toLowerCase();
if( value == "1" || value == "t" || value == "true" )
return true;
else
return false;
}
function deadlineStringToArray( str )
{
str = str.replace( "\r", "" );
var tempArray = str.split( '\n' );
var array;
if( tempArray.length > 0 )
{
array = new Array( tempArray.length - 1 );
// Only loop to second last item in tempArray, because the last item is always empty.
for( var i = 0; i < tempArray.length - 1; i ++ )
array[i] = tempArray[i].replace( "\n", "" ).replace( "\r", "" );
}
else
array = new Array( 0 );
return array;
}
function getIniSetting( key, defaultValue )
{
var value = defaultValue;
var filename;
filename = getIniFile();
iniFile = File( filename);
if( iniFile.exists )
{
iniFile.open( FileAccess.ReadOnly );
while( ! iniFile.eof )
{
var line = iniFile.readLine();
var index = line.indexOf( "=" );
if( index > 0 )
{
var currKey = line.substring( 0, index );
if( currKey == key )
{
value = line.substring( index + 1 );
value = value.trim();
break;
}
}
}
iniFile.close();
}
return value;
}
function setIniSetting( key, value )
{
var iniFileContentsString = "";
var filename;
filename = getIniFile();
iniFile = File( filename );
if( iniFile.exists )
{
iniFile.open( FileAccess.ReadOnly );
iniFileContentsString = iniFile.read() + "\n";
iniFile.close();
}
var iniFileContents = deadlineStringToArray( iniFileContentsString );
newIniFile = File( filename );
newIniFile.open( FileAccess.WriteOnly);
for( var i = 0; i < iniFileContents.length; i ++ )
{
var line = iniFileContents[i];
if( line.length > 0 )
{
var index = line.indexOf( "=" );
if( index > 0 )
{
var currKey = line.substring( 0, index );
if( currKey != key )
newIniFile.writeLine( line );
}
}
}
newIniFile.writeLine( key + "=" + value );
newIniFile.close();
}
// Sets the global function above so that deadlinecommand only gets called once
// to get the settings directory.
function getIniFile()
{
if (HarmonyIniFilename == "" )
{
var prefix = callDeadlineCommand(["-GetSettingsDirectory"]);
prefix = trim(prefix);
if (System.osName == "MacOS")
HarmonyIniFilename = prefix + "//harmony_submission.ini";
else if (System.osName == "Linux")
HarmonyIniFilename = prefix + "//harmony_submission.ini";
else
HarmonyIniFilename = prefix + "\\harmony_submission.ini";
}
return HarmonyIniFilename;
}
function InnerSubmitToDeadline( path )
{
// Value to detect if user installed the incorrect script
sentinal = 1;
var uiPath = trim(path) + "/SubmitHarmonyToDeadline.ui";
this.ui = UiLoader.load(uiPath);
this.getMachineList = function( )
{
var originalMachineList = this.ui.jobOptionsBox.machineListBox.text;
var machineListString = callDeadlineCommand( ["-selectmachinelist",originalMachineList] );
if( machineListString.indexOf( "Action was cancelled by user" ) == -1 )
this.ui.jobOptionsBox.machineListBox.setText( trim( machineListString ) );
}
this.getLimits = function( )
{
var originalLimits = this.ui.jobOptionsBox.limitsBox.text;
var limitsString = callDeadlineCommand( ["-selectlimitgroups",originalLimits] );
if( limitsString.indexOf( "Action was cancelled by user" ) == -1 )
this.ui.jobOptionsBox.limitsBox.setText( trim( limitsString ) );
}
this.getDependencies = function( )
{
var originalDependencies = this.ui.jobOptionsBox.dependenciesBox.text;
var dependenciesString = callDeadlineCommand( ["-selectdependencies",originalDependencies] );
if( dependenciesString.indexOf( "Action was cancelled by user" ) == -1 )
this.ui.jobOptionsBox.dependenciesBox.setText( trim( dependenciesString ) );
}
this.submit = function( )
{
results = "";
tempFolder = "";
tempFolder = callDeadlineCommand( ["-GetCurrentUserHomeDirectory"] )
tempFolder = trim( tempFolder )
if (System.osName == "MacOS")
tempFolder = tempFolder + "/temp/";
else
tempFolder = tempFolder + "\\temp\\";
sceneFile = scene.currentProjectPath() +"/"+ scene.currentVersionName()+".xstage"
jobName = this.ui.jobDescriptionGroup.jobNameBox.text;
comment = this.ui.jobDescriptionGroup.commentBox.text;
department = this.ui.jobDescriptionGroup.departmentBox.text;
group = this.ui.jobOptionsBox.groupBox.currentText;
pool = this.ui.jobOptionsBox.poolBox.currentText;
secondaryPool = this.ui.jobOptionsBox.secondaryPoolBox.currentText;
priority = this.ui.jobOptionsBox.priorityBox.value;
taskTimeout = this.ui.jobOptionsBox.taskTimeoutBox.value;
limitGroups = this.ui.jobOptionsBox.limitsBox.text;
concurrentTasks = this.ui.jobOptionsBox.concurrentTasksBox.value;
jobDependencies = this.ui.jobOptionsBox.dependenciesBox.text;
onComplete = this.ui.jobOptionsBox.onCompleteBox.currentText;
machineList = this.ui.jobOptionsBox.machineListBox.text;
isBlacklist = this.ui.jobOptionsBox.machineListIsBlacklistBox.checked;
submitSuspended = this.ui.jobOptionsBox.submitSuspendedBox.checked;
machineLimit = this.ui.jobOptionsBox.machineLimitBox.value;
chunkSize = this.ui.jobOptionsBox.chunkSizeBox.value;
frameList = this.ui.renderOptionsGroup.frameListBox.text;
submitScene = this.ui.jobOptionsBox.submitSceneBox.checked;
resolutionX = this.ui.renderOptionsGroup.resolutionXBox.value;
resolutionY = this.ui.renderOptionsGroup.resolutionYBox.value;
fieldOfView = this.ui.renderOptionsGroup.fieldOfViewBox.value;
camera = this.ui.renderOptionsGroup.cameraBox.currentText;
var versionRegex = / (\d+)\.\d+\.\d/;
versionInformation = about.getVersionInfoStr();
matches = versionInformation.match( versionRegex );
version = matches[1]
jobInfoFilePath = tempFolder+"harmony_submit_info.job"
var jobInfoFile = new File( jobInfoFilePath );
jobInfoFile.open(FileAccess.WriteOnly);
jobInfoFile.writeLine("Plugin=Harmony")
jobInfoFile.writeLine( "Name=" + jobName );
jobInfoFile.writeLine( "Comment=" + comment );
jobInfoFile.writeLine( "Department=" + department );
jobInfoFile.writeLine( "Group=" +group );
jobInfoFile.writeLine( "Pool=" +pool );
jobInfoFile.writeLine( "SecondaryPool=" +secondaryPool );
jobInfoFile.writeLine( "Priority=" +priority );
jobInfoFile.writeLine( "TaskTimeoutMinutes=" +taskTimeout );
jobInfoFile.writeLine( "LimitGroups=" + limitGroups );
jobInfoFile.writeLine( "ConcurrentTasks=" + concurrentTasks );
jobInfoFile.writeLine( "JobDependencies=" + jobDependencies );
jobInfoFile.writeLine( "OnJobComplete=" + onComplete );
jobInfoFile.writeLine( "Frames=" + frameList );
jobInfoFile.writeLine( "MachineLimit=" + machineLimit );
jobInfoFile.writeLine( "ChunkSize=" + chunkSize );
if( isBlacklist )
jobInfoFile.writeLine( "Blacklist=" + machineList );
else
jobInfoFile.writeLine( "Whitelist=" + machineList );
if( submitSuspended )
jobInfoFile.writeLine( "InitialStatus=Suspended" );
jobInfoFile.close();
pluginInfoFilePath = tempFolder+"harmony_plugin_info.job"
var pluginInfoFile = new File( pluginInfoFilePath );
pluginInfoFile.open(FileAccess.WriteOnly);
pluginInfoFile.writeLine("Version="+version);
if( !submitScene )
pluginInfoFile.writeLine("SceneFile="+sceneFile);
pluginInfoFile.writeLine("ResolutionX="+resolutionX);
pluginInfoFile.writeLine("ResolutionY="+resolutionY);
pluginInfoFile.writeLine("FieldOfView="+fieldOfView);
pluginInfoFile.writeLine("Camera="+camera);
pluginInfoFile.close();
renderArguments = [];
renderArgCount = 0;
renderArguments[renderArgCount++] = jobInfoFilePath;
renderArguments[renderArgCount++] = pluginInfoFilePath;
if( submitScene )
renderArguments[renderArgCount++] = sceneFile;
results = callDeadlineCommand(renderArguments);
MessageBox.information( results );
setIniSetting( "Department", department );
setIniSetting( "Group",group );
setIniSetting( "Pool",pool );
setIniSetting( "SecondaryPool", secondaryPool );
setIniSetting( "Priority", priority );
setIniSetting( "MachineLimit", machineLimit );
setIniSetting( "LimitGroups", limitGroups );
setIniSetting( "MachineList", machineList );
setIniSetting( "IsBlacklist", isBlacklist );
setIniSetting( "SubmitSuspended", submitSuspended );
setIniSetting( "ChunkSize", chunkSize );
setIniSetting( "SubmitScene", submitScene );
setIniSetting( "OnComplete", onComplete );
setIniSetting( "TaskTimeout", taskTimeout );
setIniSetting( "ConcurrentTasks", concurrentTasks );
setIniSetting( "JobDependencies", jobDependencies );
}
this.close = function( )
{
this.ui.done(0);
}
var initDepartment = getIniSetting( "Department", "" );
var initGroup = getIniSetting( "Group", "none" );
var initPool = getIniSetting( "Pool", "none" );
var initSecondaryPool = getIniSetting( "SecondaryPool", "" );
var initPriority = parseInt( getIniSetting( "Priority", "50" ) );
var initMachineLimit = parseInt( getIniSetting( "MachineLimit", 0 ) );
var initLimitGroups = getIniSetting( "LimitGroups", "" );
var initMachineList = getIniSetting( "MachineList", "" );
var initIsBlacklist = parseBool( getIniSetting( "IsBlacklist", "false" ) );
var initSubmitSuspended = parseBool( getIniSetting( "SubmitSuspended", "false" ) );
var initChunkSize = parseInt( getIniSetting( "ChunkSize", "1" ) );
var initSubmitScene = parseBool( getIniSetting( "SubmitScene", "false" ) );
var initOnComplete = getIniSetting( "OnComplete", "Nothing" );
var initTaskTimeout = parseInt( getIniSetting( "TaskTimeout", "0" ) );
var initConcurrentTasks = parseInt( getIniSetting( "ConcurrentTasks", "1" ) );
resolutionX = scene.currentResolutionX();
resolutionY = scene.currentResolutionY();
resolutionFov = scene.defaultResolutionFOV();
emptyArray = [""];
cameras = emptyArray.concat( node.getCameras() );
curCam = cameras.indexOf(node.getDefaultCamera());
var poolString = callDeadlineCommand( ["-pools"] );
var pools = deadlineStringToArray( poolString );
initPoolIndex = pools.indexOf(initPool);
secondaryPools = [""]
secondaryPools = secondaryPools.concat(pools)
initSecondaryPoolIndex = secondaryPools.indexOf(initSecondaryPool);
var groupString = callDeadlineCommand( ["-groups"] );
var groups = deadlineStringToArray( groupString );
initGroupIndex = groups.indexOf(initGroup);
var maxPriorityString = callDeadlineCommand( ["-getmaximumpriority"] );
var maximumPriority = parseInt(maxPriorityString);
if (initPriority > maximumPriority)
initPriority = Math.round( maximumPriority / 2 );
this.ui.jobDescriptionGroup.jobNameBox.setText( scene.currentScene() + " - "+scene.currentVersionName() )
this.ui.jobDescriptionGroup.departmentBox.setText( initDepartment )
this.ui.jobOptionsBox.poolBox.addItems( pools );
if(initPoolIndex >=0)
this.ui.jobOptionsBox.poolBox.setCurrentIndex( initPoolIndex );
this.ui.jobOptionsBox.secondaryPoolBox.addItems( secondaryPools );
if(initSecondaryPoolIndex >=0)
this.ui.jobOptionsBox.secondaryPoolBox.setCurrentIndex( initSecondaryPoolIndex );
this.ui.jobOptionsBox.groupBox.addItems( groups );
if(initGroupIndex >= 0)
this.ui.jobOptionsBox.groupBox.setCurrentIndex( initGroupIndex );
this.ui.jobOptionsBox.priorityBox.maximum = maximumPriority;
this.ui.jobOptionsBox.priorityBox.setValue(initPriority);
this.ui.jobOptionsBox.machineLimitBox.setValue(initMachineLimit);
this.ui.jobOptionsBox.limitsBox.setText(initLimitGroups);
this.ui.jobOptionsBox.machineListBox.setText(initMachineList);
this.ui.jobOptionsBox.machineListIsBlacklistBox.setChecked(initIsBlacklist);
this.ui.jobOptionsBox.submitSuspendedBox.setChecked(initSubmitSuspended);
this.ui.jobOptionsBox.chunkSizeBox.setValue(initChunkSize);
this.ui.jobOptionsBox.submitSceneBox.setChecked(initSubmitScene);
this.ui.jobOptionsBox.machineListButton.pressed.connect( this, this.getMachineList );
this.ui.jobOptionsBox.limitsButton.pressed.connect( this, this.getLimits );
this.ui.jobOptionsBox.dependenciesButton.pressed.connect( this, this.getDependencies );
this.ui.jobOptionsBox.concurrentTasksBox.setValue(initConcurrentTasks);
this.ui.jobOptionsBox.taskTimeoutBox.setValue(initTaskTimeout);
this.ui.submitButton.pressed.connect( this, this.submit );
this.ui.closeButton.pressed.connect( this, this.close );
onCompletes = new Array( 3 );
onCompletes[0] = "Nothing";
onCompletes[1] = "Archive";
onCompletes[2] = "Delete";
this.ui.jobOptionsBox.onCompleteBox.addItems( onCompletes );
this.ui.renderOptionsGroup.frameListBox.setText("1-"+frame.numberOf())
this.ui.renderOptionsGroup.resolutionXBox.setValue( resolutionX );
this.ui.renderOptionsGroup.resolutionYBox.setValue( resolutionY );
this.ui.renderOptionsGroup.fieldOfViewBox.setValue( resolutionFov );
this.ui.renderOptionsGroup.cameraBox.addItems( cameras );
if( curCam >= 0 )
this.ui.renderOptionsGroup.cameraBox.setCurrentIndex( curCam );
this.ui.exec();
}
Thanks! I’ll add these notes to our internal ticket.