"; $resultat = dbQuery($connection, $request); $rows = mysql_fetch_array($resultat); $appName = $rows["name"]; $request = "SELECT * FROM users WHERE login='".$V_Login."'"; // echo $request."
"; $resultat = dbQuery($connection, $request); $rows = mysql_fetch_array($resultat); $userUID = $rows["uid"]; /* * if any param given... */ if (isset ($_POST["V_cmdLine"])) $cmdLine = $_POST["V_cmdLine"]; if (isset ($_POST["V_AppName"])) $appName = $_POST["V_AppName"]; if (isset ($_POST["V_stdinName"])) $stdinName = $_POST["V_stdinName"]; if (isset ($_POST["V_dirinName"])) $dirinName = $_POST["V_dirinName"]; echo "
\n"; echo "

Add job for application "".$appName.""

\n"; echo "
\n"; if (isset ($V_nbOccurences)) { $connection = dbConnect(); if ($connection == 0) return 0; $upload_err = 0; /* * Upload file dirin */ // if (is_uploaded_file($dirinName)) { if (isset($_FILES['V_dirinName']['name'])) { $dirinNameFileName = $_FILES['V_dirinName']['name']; $dirinNameFileNameDB = "'".$dirinNameFileName."'"; $dirinNameFile = $_FILES['V_dirinName']['tmp_name']; } if($dirinNameFileNameDB == "''") { $dirinNameFileNameDB = "NULL"; } /* * Upload file stdin */ // if (is_uploaded_file($stdinName)) { if (isset($_FILES['V_stdinName']['name'])) { $stdinNameFileName = $_FILES['V_stdinName']['name']; $stdinNameFileNameDB = "'".$stdinNameFileName."'"; $stdinNameFile = $_FILES['V_stdinName']['tmp_name']; } if($stdinNameFileNameDB == "''") { $stdinNameFileNameDB = "NULL"; } if (!isset ($V_nbOccurences)) $V_nbOccurences = 1; echo "

"; for ($i = 0; $i < $V_nbOccurences; $i++) { /* * Find a random unique ID */ $jobUID = rand (0,32000).":".rand (0,3000000).":".rand (0,128); $found = true; while ($found) { $request = "SELECT uid FROM works WHERE uid='".$jobUID."'"; $resultat = dbQuery($connection, $request); $found = false; while ($rows = mysql_fetch_array($resultat)) { $found = true; } if ($found) { // echo "found ".$rows['uid']."
"; $jobUID = rand (0,32000).":".rand (0,3000000).":".rand (0,128); } // else // echo "not found $jobUID
"; } /* echo "jobUID = $jobUID
"; echo "appUID = $appUID
"; echo "cmdLine = $cmdLine
"; echo "dirinName = $dirinName
"; echo "stdInName = $stdiInName
"; echo "V_nbOccurences = $V_nbOccurences
"; */ /* * Update database * Let first note this work as 'INVALID' so that XW server will try to launch it * until insertion is finished (i.e. until dir/files correctly inserted) */ $request = "INSERT INTO works (uid, app, user, status,resultStatus,cmdLine,dirinName,stdInName) VALUES ('".$jobUID."','".$appUID."','".$userUID."', 'INVALID','UNAVAILABLE','".$cmdLine."',".$dirinNameFileNameDB.",".$stdinNameFileNameDB.")"; // echo $request; // echo "
".$randomDir; // return; $resultat = dbQuery($connection, $request); /* $request = "SELECT wid FROM works WHERE uid='".$jobUID."'"; $wid = ""; while ($wid == "") { $resultat = dbQuery($connection, $request); while ($rows = mysql_fetch_array($resultat)) { $wid = $rows["wid"]; break; } } */ /* * create directory structure */ $subdirName = configGetRootDirectory().$randomDir."/"; $dirName = "".getcwd()."/$subdirName"; echo "subdir = $subdirName
"; if (!file_exists ($dirName)) { // mkdir ($dirName, 0770) || die ("can't create ".$dirName); mkdir ($dirName, 0770) || $upload_err = 1; chmod ($dirName, 0770); } /* $dirName = $dirName.$V_Login."/"; if (!file_exists ($dirName)) { mkdir ($dirName, 0770) || die ("can't create ".$dirName); chmod ($dirName, 0770); } $dirName = $dirName.$wid."/"; if (!file_exists ($dirName)) { mkdir ($dirName, 0770) || die ("can't create ".$dirName); chmod ($dirName, 0770); } */ /* * save uploaded file dirin */ if ((isset ($dirinNameFileName)) && ($upload_err == 0)) { echo $dirName.$dirinNameFileName."
"; if (!move_uploaded_file($dirinNameFile, $dirName.$dirinNameFileName)) { $upload_err = 1; echo "$dirinNameFile, $dirName.$dirinNameFileName error
"; } else { chmod ($dirName.$dirinNameFileName, 0770); } } /* * save uploaded file stdin */ if (($stdinNameFileName != "") && ($upload_err == 0)) { if (!move_uploaded_file($stdinNameFile, $dirName.$stdinNameFileName)) { $upload_err = 1; echo "$stdinNameFile, $dirName.$stdinNameFileName error
"; } else { chmod ($dirName.$stdinNameFileName, 0770); } } /* * Update database * Here, dir/files are correctly inserted * We can now note this work as 'WAITING' so that XW server would launch it correctly */ echo "Job ".$jobUID; if ($upload_err == 1) { $request = "DELETE FROM works WHERE uid='".$jobUID."'"; $resultat = dbQuery($connection, $request); echo " upload error...
"; } else { echo "dirinNameFileNameDB = $dirinNameFileNameDB
"; if($dirinNameFileNameDB != "NULL") { $dirinNameFileNameDB = $randomDir."/".$dirinNameFileName; } echo "dirinNameFileNameDB = $dirinNameFileNameDB
"; echo "stdinNameFileNameDB = $stdinNameFileNameDB
"; if($stdinNameFileNameDB != "NULL") { $stdinNameFileNameDB = $randomDir."/".$stdinNameFileName; } echo "stdinNameFileNameDB = $stdinNameFileNameDB
"; $request = "UPDATE works set status='WAITING', local='true',active='true',dirinName='".$dirinNameFileNameDB."',stdInName='".$stdinNameFileNameDB."' WHERE uid='".$jobUID."'"; echo $request."
"; $resultat = dbQuery($connection, $request); echo " successfully inserted ...
"; } } echo "


\n"; echo "
\n"; echo "
\n"; return; } echo "
\n"; ?> \n"; echo "\n"; echo "\n"; ?> Please, fill the following form (examples follow)

  • the ZIP file helps to recreate needed directories structure;
  • the input file will be passed as standard input;
  • the arguments are passed to the application ( as if the application would be called from any prompt shell ).

  • Zip file 
    Input file 
    Arguments 
    Occurences  (This specifies how many occurences of this work you want)


    Example:
    1. First of all, note the Occurences parameter ; this tells how many occurences of the same work you want to submit.
      Default is "1" ; it inserts one work only.


    2. suppose you would like to execute an application which name is , with the argument -l
      In an shell, you would type :
      
      
      
      
      We can see that your application needs no input from standard input, neither it needs any dedicated directories structure...
      The previous form should then been filled like this :
      • leave Zip file empty;
      • leave input file empty;
      • fill argument with -l.


    3. now, if you want to execute what should be in an shell :
      
      
      
      
      Here, your application needs a standard input (myFile.txt), an argument (-b), but still no dedicated directories structure...
      The previous form should then been filled like this :
      • leave Zip file empty;
      • fill input file with myFile.txt (use the "browse" button);
      • fill argument with -b.


    4. finally, to execute what should be in an shell :
      
      
      
      
      Then, your application needs no standard input, no argument, but a dedicated directories structure containing your directory named myDirectory...
      The previous form should then been filled like this :
      • zip your directory named myDirectory in a zip file;
      • fill zip file with your zip file (use the "browse" button);
      • leave input file empty;
      • leave argument empty.


    5. Of course, all parameters combinaisons shown above are allowed...