Example #1
0
// Also whether stderr output is reported correctly
include_once "test.inc";
$project = new Project();
$user = new User();
$host = new Host($user);
$app = new App("upper_case");
$app_version = new App_Version($app);
$project->add_user($user);
$project->add_app($app);
$project->add_app_version($app_version);
$project->start_feeder = true;
$project->start_make_work = true;
$project->start_validate = true;
$project->start_file_delete = true;
$project->start_assimilator = true;
$project->install();
// must install projects before adding to hosts
$host->log_flags = "log_flags.xml";
$host->add_user($user, $project);
$host->install();
echo "adding work\n";
$work = new Work($app);
$work->wu_template = "uc_wu";
$work->result_template = "uc_result";
$work->redundancy = 3;
array_push($work->input_files, "input");
$work->install($project);
$project->start_feeder();
$project->start_make_work($work);
$project->start_validate($app, 3);
$project->start_file_delete();
Example #2
0
 /**
  * Runs the application, returning the status to exit with.
  * 
  * @return integer The exit status.
  * @access public
  */
 public function run()
 {
     $exit_status = 0;
     // Curator doesn't do anything without at least one argument, besides the curator command itself.
     if ($this->argc === 0) {
         Console::stdout('Use \'' . $this->cmd . ' --help\' for usage information.');
     } else {
         try {
             $parser = $this->buildCommandLineParser();
             $result = $parser->parse();
             // determine where our relevant directories are.
             if (!empty($result->options['proj_path'])) {
                 $project_dir = realpath($result->options['proj_path']);
             }
             if (empty($project_dir)) {
                 $project_dir = $_SERVER['PWD'];
             }
             $this->createDirectoryAtPath($project_dir);
             try {
                 $project = new Project($project_dir);
                 switch ($result->command_name) {
                     case 'new':
                         $project->install();
                         break;
                     case 'clean':
                         $project->clean();
                         break;
                     case 'build':
                         $project->build();
                         break;
                 }
             } catch (\Exception $e) {
                 Console::stderr('** Command \'' . $result->command_name . '\' has failed:');
                 Console::stderr('  ' . $e->getMessage());
             }
         } catch (\Exception $e) {
             $parser->displayError($e->getMessage());
             $exit_status = $e->getCode();
         }
     }
     return $exit_status;
 }
Example #3
0
$work->delay_bound = 60;
array_push($work->input_files, "input");
$project1->resource_share = 1;
$project1->shmem_key = "0x12344321";
$project1->short_name = "Project1";
$project1->long_name = "Project1";
$project1->add_user($user);
$project1->install();
// must install projects before adding to hosts
$project1->install_feeder();
$project2->resource_share = 5;
$project2->shmem_key = "0x12345678";
$project2->short_name = "Project2";
$project2->long_name = "Project2";
$project2->add_user($user);
$project2->install();
// must install projects before adding to hosts
$project2->install_feeder();
$host->add_user($user, $project1);
$host->add_user($user, $project2);
$host->install();
$work->install($project1);
$work->install($project2);
$project1->start_servers();
$project2->start_servers();
$host->run("-exit_when_idle -skip_cpu_benchmarks");
$project1->stop(1);
$project2->stop();
$result->server_state = RESULT_SERVER_STATE_OVER;
$project1->check_results(5, $result);
$project1->compare_file("uc_wu_0_0", "uc_correct_output");
Example #4
0
 public static function install()
 {
     session_destroy();
     //
     // Create necessary dirs
     //
     if (!file_exists(CINTIENT_WORK_DIR) && !mkdir(CINTIENT_WORK_DIR, DEFAULT_DIR_MASK, true)) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not create working dir. Check your permissions.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     if (!file_exists(CINTIENT_PROJECTS_DIR) && !mkdir(CINTIENT_PROJECTS_DIR, DEFAULT_DIR_MASK, true)) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not create projects dir. Check your permissions.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     if (!file_exists(CINTIENT_ASSETS_DIR) && !mkdir(CINTIENT_ASSETS_DIR, DEFAULT_DIR_MASK, true)) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not create assets dir. Check your permissions.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     if (!file_exists(CINTIENT_AVATARS_DIR) && !mkdir(CINTIENT_AVATARS_DIR, DEFAULT_DIR_MASK, true)) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not create avatars dir. Check your permissions.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     //
     // Setup all objects
     //
     if (!User::install()) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not setup User object.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     if (!Project::install()) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not setup Project object.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     if (!SystemSettings::install()) {
         SystemEvent::raise(SystemEvent::ERROR, "Could not setup SystemSettings object.", __METHOD__);
         echo "Error";
         // TODO: treat this properly
         exit;
     }
     //
     // Test user setup
     //
     $user = new User();
     $user->setEmail('*****@*****.**');
     $user->setNotificationEmails('pedro.matamouros@gmail.com,');
     $user->setName('Pedro Mata-Mouros');
     $user->setUsername('matamouros');
     $user->setCos(UserCos::ROOT);
     $user->init();
     $user->setPassword('pedro');
     header('Location: ' . UrlManager::getForDashboard());
     exit;
 }
Example #5
0
 if (!Database::beginTransaction(Database::EXCLUSIVE_TRANSACTION)) {
     $ok = false;
     $msg = "Problems obtaining an exclusive lock on the database.";
     SystemEvent::raise(CINTIENT_LOG_SEVERITY_ERROR, $msg, "Installer");
     sendResponse($ok, $msg);
 }
 //
 // Setup all objects
 //
 if (!User::install()) {
     $ok = false;
     $msg = "Could not setup User object.";
     SystemEvent::raise(CINTIENT_LOG_SEVERITY_ERROR, $msg, "Installer");
     sendResponse($ok, $msg);
 }
 if (!Project::install()) {
     $ok = false;
     $msg = "Could not setup Project object.";
     SystemEvent::raise(CINTIENT_LOG_SEVERITY_ERROR, $msg, "Installer");
     sendResponse($ok, $msg);
 }
 if (!SystemSettings::install()) {
     $ok = false;
     $msg = "Could not setup SystemSettings object.";
     SystemEvent::raise(CINTIENT_LOG_SEVERITY_ERROR, $msg, "Installer");
     sendResponse($ok, $msg);
 }
 //
 // Everything ok!!!
 //
 if (!Database::endTransaction()) {