Esempio n. 1
0
function defaultOutput($tracking)
{
    $db = new AutotuneDb();
    $pos = $db->getQueuePosition($tracking);
    $details = array("tracking" => $tracking, "position" => $pos, "terminate" => $db->getTerminate($tracking), "runtime" => $db->getRuntime($tracking));
    $modelIds = $db->getModelIds($tracking);
    $models = array();
    foreach ($modelIds as $x => $value) {
        $models[$x] = array("id" => $value, "fitness" => $db->getFit($value));
    }
    return outputDetails($details, $models);
}
Esempio n. 2
0
			Name = "tuned_[modelId].idf"
	
	
----------Download multiple models------------
	Input
		Required -> tracking, models
	Output
		Zip file
			Name = "[tracking].zip"
			Contents = all models named as "tuned_[modelId].idf"
			
If modelId and models are both included, models will be used by default and modelId will be ignored.
If models contains an invalid model, all models for the tracking will be provided instead.
*/
require 'dbAccess.php';
$db = new AutotuneDb();
if (isset($_REQUEST['tracking'])) {
    $tracking = $_REQUEST['tracking'];
    //check if tracking is valid
    if ($db->validTracking($tracking)) {
        // download a single model
        if (isset($_REQUEST['modelId']) && !isset($_REQUEST['models'])) {
            $modelId = $_REQUEST['modelId'];
            //check if model id is valid
            if ($db->validModelId($modelId)) {
                $fileName = "tuned_{$modelId}.idf";
                $dir = "filesFolder";
                file_put_contents("{$dir}/{$fileName}", $db->getFile($modelId));
                $db->downloadFile("{$dir}/{$fileName}");
                unlink("{$dir}/{$fileName}");
            }