diff --git a/app.yaml b/app.yaml index f45f64259..b5ded82d1 100644 --- a/app.yaml +++ b/app.yaml @@ -65,4 +65,4 @@ skip_files: - ^(.*/)?core/configs/.*\.local\.ini$ - ^(.*/)?(\.git|\.idea|\.vagrant|data|docs|env|log|provisioning|site|tests|tmp|utils)/.* - ^(.*/)?(core|modules/.*)/(database/(pgsql|sqlite)|tests)/.* - - ^(.*/)?modules/(archive|batchmake|dicom.*|javauploaddownload|metadataextractor|pvw|remoteprocessing|solr|statistics|visualize)/.* + - ^(.*/)?modules/(archive|dicom.*|javauploaddownload|metadataextractor|pvw|remoteprocessing|solr|statistics|visualize)/.* diff --git a/core/views/install/index.phtml b/core/views/install/index.phtml index fec7d79a3..c039cb8e3 100644 --- a/core/views/install/index.phtml +++ b/core/views/install/index.phtml @@ -29,7 +29,6 @@
  • Hosts public and private collections of data;
  • Handles massive collections and images;
  • Manages images, files, and metadata;
  • -
  • Integrates BatchMake technology for server-side and standalone batch processing;
  • Builds upon open source code and open standards.
  • diff --git a/modules/batchmake/AppController.php b/modules/batchmake/AppController.php deleted file mode 100644 index 32121ab50..000000000 --- a/modules/batchmake/AppController.php +++ /dev/null @@ -1,25 +0,0 @@ -enableWebAPI($this->moduleName); - $this->addCallBack('CALLBACK_CORE_GET_DASHBOARD', 'getDashboard'); - // hiding left link Batchmake icon, this isn't necessary to show - // $this->addCallBack('CALLBACK_CORE_GET_LEFT_LINKS', 'getLeftLink'); - } - - /** - * will generate information about this module to display on the Dashboard. - * - * @return array with key being the module name, the value being an array - * of configuration correctness values (0 or 1). - */ - public function getDashboard() - { - $return = array('Batchmake' => array($this->ModuleComponent->KWBatchmake->isConfigCorrect())); - - return $return; - } - - /** - * will generate a link for this module to be displayed in the main view. - * - * @return ['batchmake' => [ link to batchmake module, module icon image path]] - */ - public function getLeftLink() - { - $fc = Zend_Controller_Front::getInstance(); - $baseURL = $fc->getBaseUrl(); - $moduleWebroot = $baseURL.'/'.MIDAS_BATCHMAKE_MODULE; - - return array( - ucfirst(MIDAS_BATCHMAKE_MODULE) => array( - $moduleWebroot.'/index', - $baseURL.'/modules/batchmake/public/images/cmake.png', - ), - ); - } -} diff --git a/modules/batchmake/configs/module.ini b/modules/batchmake/configs/module.ini deleted file mode 100644 index 4d8766468..000000000 --- a/modules/batchmake/configs/module.ini +++ /dev/null @@ -1,16 +0,0 @@ -; Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0. - -[global] -fullname = "BatchMake" -description = "Run a BatchMake pipeline either locally or via Condor" -category = "Processing" -dependencies = api -uuid = "290da3c9-2e57-4866-b727-645a47419dc5" -version = "1.0.0" - -batchmake.app_dir = "" -batchmake.bin_dir = "" -batchmake.condor_bin_dir = "" -batchmake.data_dir = "" -batchmake.script_dir = "" -batchmake.tmp_dir = "" diff --git a/modules/batchmake/constant/module.php b/modules/batchmake/constant/module.php deleted file mode 100644 index 3af5381cd..000000000 --- a/modules/batchmake/constant/module.php +++ /dev/null @@ -1,118 +0,0 @@ -requireAdminPrivileges(); - - $this->view->pageTitle = 'BatchMake Module Configuration'; - $config = $this->ModuleComponent->KWBatchmake->loadConfigProperties(null, false); - $form = new Batchmake_Form_Admin(); - - if ($this->getRequest()->isPost()) { - $data = $this->getRequest()->getPost(); - - if ($form->isValid($data)) { - $values = $form->getValues(); - - foreach ($values as $key => $value) { - if ($key !== MIDAS_BATCHMAKE_CSRF_TOKEN && !is_null($value)) { - $config[MIDAS_BATCHMAKE_GLOBAL_CONFIG_NAME][$this->moduleName.'.'.$key] = $value; - } - } - - UtilityComponent::createInitFile(MIDAS_BATCHMAKE_MODULE_LOCAL_CONFIG, $config); - } - - $form->populate($data); - } else { - $elements = $form->getElements(); - - foreach ($elements as $element) { - $batchMakeConfig = $this->ModuleComponent->KWBatchmake->filterBatchmakeConfigProperties($config); - $defaultConfig = $this->createDefaultConfig($batchMakeConfig); - $name = $element->getName(); - - if ($name !== MIDAS_BATCHMAKE_CSRF_TOKEN && $name !== MIDAS_BATCHMAKE_SUBMIT_CONFIG) { - $value = $defaultConfig[$name]; - - if (!is_null($value)) { - $form->setDefault($name, $value); - } - } - } - } - - $this->view->form = $form; - session_start(); - } - - /** - * will create default paths in the temporary directory - * for any properties not already set, except for the - * condor bin dir; imposing a firmer hand on the user. - * - * @param array $currentConfig current configuration - * @return array - */ - protected function createDefaultConfig($currentConfig) - { - $defaultConfigDirs = array( - MIDAS_BATCHMAKE_TMP_DIR_PROPERTY => MIDAS_BATCHMAKE_DEFAULT_TMP_DIR, - MIDAS_BATCHMAKE_BIN_DIR_PROPERTY => MIDAS_BATCHMAKE_DEFAULT_BIN_DIR, - MIDAS_BATCHMAKE_SCRIPT_DIR_PROPERTY => MIDAS_BATCHMAKE_DEFAULT_SCRIPT_DIR, - MIDAS_BATCHMAKE_APP_DIR_PROPERTY => MIDAS_BATCHMAKE_DEFAULT_APP_DIR, - MIDAS_BATCHMAKE_DATA_DIR_PROPERTY => MIDAS_BATCHMAKE_DEFAULT_DATA_DIR, - ); - - $returnedConfig = array(); - - foreach ($currentConfig as $configProp => $configDir) { - if ((!isset($configProp) || !isset($configDir) || empty($configDir)) && array_key_exists( - $configProp, - $defaultConfigDirs - ) - ) { - $returnedConfig[$configProp] = UtilityComponent::getTempDirectory($defaultConfigDirs[$configProp]); - } else { - $returnedConfig[$configProp] = $configDir; - } - } - - return $returnedConfig; - } -} diff --git a/modules/batchmake/controllers/components/ApiComponent.php b/modules/batchmake/controllers/components/ApiComponent.php deleted file mode 100644 index 2d7d51779..000000000 --- a/modules/batchmake/controllers/components/ApiComponent.php +++ /dev/null @@ -1,217 +0,0 @@ -getUser($args, Zend_Registry::get('userSession')->Dao); - } - - /** - * @param tmp_dir the path to the batchmake temp dir - * @param bin_dir the path to the batchmake bin dir, should have BatchMake exe - * @param script_dir the path to the batchmake script dir, where bms files live - * @param app_dir the path to the dir housing executables - * @param data_dir the path to the data export dir - * @param condor_bin_dir the path to the location of the condor executables - * @return an array, the first value is a 0 if the config is incorrect or 1 - * if the config is correct, the second value is a list of individual config values and their statuses. - */ - public function testconfig($params) - { - // any values that aren't filled in, fill them in with a blank - $expectedKeys = array('tmp_dir', 'bin_dir', 'script_dir', 'app_dir', 'data_dir', 'condor_bin_dir'); - $configParams = array(); - foreach ($expectedKeys as $propKey) { - if (!isset($params[$propKey])) { - $configParams[$propKey] = ''; - } else { - $configParams[$propKey] = $params[$propKey]; - } - } - - /** @var Batchmake_KWBatchmakeComponent $kwbatchmakeComponent */ - $kwbatchmakeComponent = MidasLoader::loadComponent('KWBatchmake', 'batchmake'); - - return $kwbatchmakeComponent->testconfig($configParams); - } - - /** - * Add a condorDag entry to the specified batchmake task. - * - * @param token Authentication token - * @param batchmaketaskid The id of the batchmake task for this dag - * @param dagfilename The filename of the dagfile - * @param outfilename The filename of the dag processing output - * @return The created CondorDagDao. - * @throws Exception - */ - public function addCondorDag($params) - { - $keys = array( - 'batchmaketaskid' => 'batchmaketaskid', - 'dagfilename' => 'dagfilename', - 'outfilename' => 'outfilename', - ); - $this->_checkKeys($keys, $params); - - $userDao = $this->_getUser($params); - if (!$userDao) { - throw new Exception('Anonymous users may not add condor dags', MIDAS_BATCHMAKE_INVALID_POLICY); - } - - /** @var Batchmake_TaskModel $taskModel */ - $taskModel = MidasLoader::loadModel('Task', 'batchmake'); - - /** @var Batchmake_CondorDagModel $condorDagModel */ - $condorDagModel = MidasLoader::loadModel('CondorDag', 'batchmake'); - - $batchmakeTaskId = $params['batchmaketaskid']; - $dagFilename = $params['dagfilename']; - $outFilename = $params['outfilename']; - - $taskDao = $taskModel->load($batchmakeTaskId); - if (empty($taskDao)) { - throw new Exception('Invalid batchmaketaskid specified', MIDAS_BATCHMAKE_INVALID_PARAMETER); - } - if ($taskDao->getUserId() !== $userDao->getUserId()) { - throw new Exception('You are not the owner of this batchmake task', MIDAS_BATCHMAKE_INVALID_POLICY); - } - - $data = array( - 'batchmake_task_id' => $batchmakeTaskId, - 'dag_filename' => $dagFilename, - 'out_filename' => $outFilename, - ); - - $condorDagDao = $condorDagModel->initDao('CondorDag', $data, 'batchmake'); - $condorDagModel->save($condorDagDao); - - return $condorDagDao; - } - - /** - * Add a condorJob entry to the specified batchmake task. - * - * @param token Authentication token - * @param batchmaketaskid The id of the batchmake task for this dag - * @param outputfilename The filename of the output file for the job - * @param errorfilename The filename of the error file for the job - * @param logfilename The filename of the log file for the job - * @param postfilename The filename of the post script log file for the job - * @return The created CondorJobDao. - * @throws Exception - */ - public function addCondorJob($params) - { - $keys = array( - 'batchmaketaskid' => 'batchmaketaskid', - 'jobdefinitionfilename' => 'jobdefinitionfilename', - 'outputfilename' => 'outputfilename', - 'errorfilename' => 'errorfilename', - 'logfilename' => 'logfilename', - 'postfilename' => 'postfilename', - ); - $this->_checkKeys($keys, $params); - - $userDao = $this->_getUser($params); - if (!$userDao) { - throw new Exception('Anonymous users may not add condor jobs', MIDAS_BATCHMAKE_INVALID_POLICY); - } - - /** @var Batchmake_TaskModel $taskModel */ - $taskModel = MidasLoader::loadModel('Task', 'batchmake'); - - /** @var Batchmake_CondorDagModel $condorDagModel */ - $condorDagModel = MidasLoader::loadModel('CondorDag', 'batchmake'); - - /** @var Batchmake_CondorJobModel $condorJobModel */ - $condorJobModel = MidasLoader::loadModel('CondorJob', 'batchmake'); - - $batchmakeTaskId = $params['batchmaketaskid']; - $jobdefinitionFilename = $params['jobdefinitionfilename']; - $outputFilename = $params['outputfilename']; - $errorFilename = $params['errorfilename']; - $logFilename = $params['logfilename']; - $postFilename = $params['postfilename']; - - $taskDao = $taskModel->load($batchmakeTaskId); - if (empty($taskDao)) { - throw new Exception('Invalid batchmaketaskid specified', MIDAS_BATCHMAKE_INVALID_PARAMETER); - } - if ($taskDao->getUserId() !== $userDao->getUserId()) { - throw new Exception('You are not the owner of this batchmake task', MIDAS_BATCHMAKE_INVALID_POLICY); - } - - // get the dag via the batchmaketask - $condorDags = $condorDagModel->findBy('batchmake_task_id', $batchmakeTaskId); - if (empty($condorDags) || count($condorDags) === 0) { - throw new Exception('There is no condor dag for this batchmaketaskid', MIDAS_BATCHMAKE_INVALID_PARAMETER); - } - // take the first if there are multiple - $condorDagDao = $condorDags[0]; - $condorDagId = $condorDagDao->getCondorDagId(); - - $data = array( - 'condor_dag_id' => $condorDagId, - 'jobdefinition_filename' => $jobdefinitionFilename, - 'output_filename' => $outputFilename, - 'error_filename' => $errorFilename, - 'log_filename' => $logFilename, - 'post_filename' => $postFilename, - ); - - $condorJobDao = $condorJobModel->initDao('CondorJob', $data, 'batchmake'); - $condorJobModel->save($condorJobDao); - - return $condorJobDao; - } -} diff --git a/modules/batchmake/controllers/components/ExecuteComponent.php b/modules/batchmake/controllers/components/ExecuteComponent.php deleted file mode 100644 index c6294a01e..000000000 --- a/modules/batchmake/controllers/components/ExecuteComponent.php +++ /dev/null @@ -1,187 +0,0 @@ - itemIds, expects these to each have a single bitstream, - * exports these items to a work dir, and returns a list of - * itemName => fullExportPath. - * - * @param UserDao $userDao - * @param Batchmake_TaskDao $taskDao - * @param array $itemsForExport array itemNames => itemIds - * @return array - * @throws Zend_Exception - */ - public function exportSingleBitstreamItemsToWorkDataDir($userDao, $taskDao, $itemsForExport) - { - $itemIds = array(); - foreach ($itemsForExport as $itemId) { - $itemIds[] = $itemId; - } - - // export the items to the work dir data dir - $datapath = $taskDao->getWorkDir().'/'.'data'; - if (!KWUtils::mkDir($datapath)) { - throw new Zend_Exception("couldn't create data export dir: ".$datapath); - } - - /** @var ExportComponent $exportComponent */ - $exportComponent = MidasLoader::loadComponent('Export'); - $symlink = true; - $exportComponent->exportBitstreams($userDao, $datapath, $itemIds, $symlink); - - // for each of these items, generate a path that points to a single bitstream - - // get the bitstream path, assuming latest revision of item, with one bitstream - // this seems somewhat wrong, as we are halfway recreating the export - // and dependent upon the export to work in a certain way for this to work - /** @var ItemModel $itemModel */ - $itemModel = MidasLoader::loadModel('Item'); - - $itemNamesToBitstreamPaths = array(); - foreach ($itemsForExport as $itemName => $itemId) { - $itemDao = $itemModel->load($itemId); - $revisionDao = $itemModel->getLastRevision($itemDao); - if ($revisionDao === false) { - throw new Zend_Exception('The item has no revisions', MIDAS_INVALID_POLICY); - } - $bitstreamDaos = $revisionDao->getBitstreams(); - if (empty($bitstreamDaos)) { - throw new Zend_Exception('Item '.$itemId.' has no bitstreams.'); - } - $imageBitstreamDao = $bitstreamDaos[0]; - $exportedBitstreamPath = $datapath.'/'.$itemId.'/'.$imageBitstreamDao->getName(); - $itemNamesToBitstreamPaths[$itemName] = $exportedBitstreamPath; - } - - return $itemNamesToBitstreamPaths; - } - - /** - * exports a list of itemIds to a work dir. - * - * @param UserDao $userDao - * @param Batchmake_TaskDao $taskDao - * @param array $itemIds - * @throws Zend_Exception - */ - public function exportItemsToWorkDataDir($userDao, $taskDao, $itemIds) - { - // export the items to the work dir data dir - $datapath = $taskDao->getWorkDir().'/'.'data'; - if (!KWUtils::mkDir($datapath)) { - throw new Zend_Exception("couldn't create data export dir: ".$datapath); - } - - /** @var ExportComponent $exportComponent */ - $exportComponent = MidasLoader::loadComponent('Export'); - $symlink = true; - $exportComponent->exportBitstreams($userDao, $datapath, $itemIds, $symlink); - } - - /** - * creates a python config file in a work dir, - * with all of the information needed for the given user to communicate back - * with this midas instance via the web API, will be called config.cfg, - * unless a prefix is supplied, then will be called prefixconfig.cfg. - * - * @param Batchmake_TaskDao $taskDao - * @param UserDao $userDao - * @param null|string $configPrefix - * @throws Zend_Exception - */ - public function generatePythonConfigParams($taskDao, $userDao, $configPrefix = null) - { - // generate an config file for this run - $configs = array(); - $midasPath = Zend_Registry::get('webroot'); - $configs[] = 'url http://'.$_SERVER['HTTP_HOST'].$midasPath; - $configs[] = 'appname Default'; - - $email = $userDao->getEmail(); - // get an api key for this user - /** @var UserapiModel $userApiModel */ - $userApiModel = MidasLoader::loadModel('Userapi'); - $userApiDao = $userApiModel->getByAppAndUser('Default', $userDao); - if (!$userApiDao) { - throw new Zend_Exception('You need to create a web API key for this user for application: Default'); - } - $configs[] = 'email '.$email; - $configs[] = 'apikey '.$userApiDao->getApikey(); - if ($configPrefix !== null) { - $filepath = $taskDao->getWorkDir().'/'.$configPrefix.'config.cfg'; - } else { - $filepath = $taskDao->getWorkDir().'/'.'config.cfg'; - } - - if (!file_put_contents($filepath, implode("\n", $configs))) { - throw new Zend_Exception('Unable to write configuration file: '.$filepath); - } - } - - /** - * will generate a batchmake config file in the work dir. - * - * @param Batchmake_TaskDao $taskDao - * @param array $appTaskConfigProperties list of name=>value to be exported - * @param string $condorPostScriptPath full path to the condor post script - * @param string $condorDagPostScriptPath full path to condor dag post script - * @param string $configScriptStem name of the batchmake script - * @throws Zend_Exception - */ - public function generateBatchmakeConfig( - $taskDao, - $appTaskConfigProperties, - $condorPostScriptPath, - $condorDagPostScriptPath, - $configScriptStem - ) { - $configFileLines = array(); - - foreach ($appTaskConfigProperties as $varName => $varValue) { - if (is_array($varValue)) { - $configFileLine = 'Set('.$varName.' '; - $values = array(); - foreach ($varValue as $indVarValue) { - $values[] = "'".$indVarValue."'"; - } - $configFileLine .= implode(' ', $values); - $configFileLine .= ')'; - $configFileLines[] = $configFileLine; - } else { - $configFileLines[] = 'Set('.$varName." '".$varValue."')"; - } - } - $configFileLines[] = "Set(cfg_condorpostscript '".$condorPostScriptPath."')"; - $configFileLines[] = "Set(cfg_output_directory '".$taskDao->getWorkDir()."')"; - $configFileLines[] = "Set(cfg_exe '/usr/bin/python')"; - $configFileLines[] = "Set(cfg_condordagpostscript '".$condorDagPostScriptPath."')"; - $configFileLines[] = "Set(cfg_taskID '".$taskDao->getBatchmakeTaskId()."')"; - - $configFilePath = $taskDao->getWorkDir().'/'.$configScriptStem.'.config.bms'; - if (!file_put_contents($configFilePath, implode("\n", $configFileLines)) - ) { - throw new Zend_Exception('Unable to write configuration file: '.$configFilePath); - } - } -} diff --git a/modules/batchmake/controllers/components/KWBatchmakeComponent.php b/modules/batchmake/controllers/components/KWBatchmakeComponent.php deleted file mode 100644 index 035aff930..000000000 --- a/modules/batchmake/controllers/components/KWBatchmakeComponent.php +++ /dev/null @@ -1,695 +0,0 @@ - MIDAS_BATCHMAKE_CHECK_IF_CHMODABLE_RW, - MIDAS_BATCHMAKE_BIN_DIR_PROPERTY => MIDAS_BATCHMAKE_CHECK_IF_READABLE, - MIDAS_BATCHMAKE_SCRIPT_DIR_PROPERTY => MIDAS_BATCHMAKE_CHECK_IF_READABLE, - MIDAS_BATCHMAKE_APP_DIR_PROPERTY => MIDAS_BATCHMAKE_CHECK_IF_READABLE, - MIDAS_BATCHMAKE_DATA_DIR_PROPERTY => MIDAS_BATCHMAKE_CHECK_IF_CHMODABLE_RW, - MIDAS_BATCHMAKE_CONDOR_BIN_DIR_PROPERTY => MIDAS_BATCHMAKE_CHECK_IF_READABLE, - ); - - /** - * accessor function to return the names of the config properties, and - * their filesystem requirements;. - */ - public static function getConfigPropertiesRequirements() - { - return self::$configPropertiesRequirements; - } - - protected static $applicationsPaths = array( - MIDAS_BATCHMAKE_CONDOR_STATUS => MIDAS_BATCHMAKE_CONDOR_BIN_DIR_PROPERTY, - MIDAS_BATCHMAKE_CONDOR_QUEUE => MIDAS_BATCHMAKE_CONDOR_BIN_DIR_PROPERTY, - MIDAS_BATCHMAKE_CONDOR_SUBMIT => MIDAS_BATCHMAKE_CONDOR_BIN_DIR_PROPERTY, - MIDAS_BATCHMAKE_CONDOR_SUBMIT_DAG => MIDAS_BATCHMAKE_CONDOR_BIN_DIR_PROPERTY, - MIDAS_BATCHMAKE_EXE => MIDAS_BATCHMAKE_BIN_DIR_PROPERTY, - ); - - /** - * accessor function to return the application names, along with their - * expected location property. - */ - public static function getApplicationsPaths() - { - return self::$applicationsPaths; - } - - // component configuration settings - protected $componentConfig; - // individual config properties, for convenience - protected $configScriptDir; - protected $configAppDir; - protected $configTmpDir; - protected $configBinDir; - protected $configDataDir; - protected $configCondorBinDir; - - protected $executor; - - /** - * Constructor, loads ini from standard config location, unless a - * supplied alternateConfig. - * - * @param string $alternateConfig path to alternative config ini file - */ - public function __construct($alternateConfig = null, $executor = null) - { - $this->loadConfigProperties($alternateConfig); - if (!isset($executor)) { - require_once BASE_PATH.'/modules/batchmake/library/Executor.php'; - $this->executor = new Batchmake_Executor(); - } else { - $this->executor = $executor; - } - } - - /** - * helper function to load the correct config file. - * - * @param bool $processSections param to be passed on to parse_ini_file, - * default is false - * @return config array with config properties - */ - protected function loadConfig($processSections = false) - { - if (file_exists(MIDAS_BATCHMAKE_MODULE_LOCAL_CONFIG)) { - $config = parse_ini_file(MIDAS_BATCHMAKE_MODULE_LOCAL_CONFIG, $processSections); - } else { - throw new Zend_Exception( - 'The Batchmake module has not been enabled. Enable it through the Midas administration tab' - ); - } - - return $config; - } - - /** - * takes in an array read out of an ini file, looks in the 'global' - * space, and returns an array of only those properties that begin - * with batchmake. - * - * @param type $fullConfig - * @return type - */ - public function filterBatchmakeConfigProperties($fullConfig) - { - $batchmakeProps = array(); - $globalProps = $fullConfig['global']; - $modulePropertyNamespace = MIDAS_BATCHMAKE_MODULE.'.'; - foreach ($globalProps as $configProperty => $configPropertyVal) { - $ind = strpos($configProperty, $modulePropertyNamespace); - if ($ind !== false && $ind == 0) { - $reducedKey = substr($configProperty, strpos($configProperty, '.') + 1); - $batchmakeProps[$reducedKey] = $configPropertyVal; - } - } - - return $batchmakeProps; - } - - /** - * will load the configuration property values for this module. - * - * @param string $alternateConfig an array of alternate config props - * @param bool $batchmakeOnly whether to get all properties or only config - * properties that are in the 'batchmake.' config namespace, - * removing the 'batchmake.' from the key name if true. - * @return array of batchmake module specific config properties - */ - public function loadConfigProperties($alternateConfig = null, $batchmakeOnly = true) - { - try { - // load the full config - $rawConfig = $this->loadConfig(true); - // get the global namespace props - $globalProps = $rawConfig['global']; - } catch (Zend_Exception $ze) { - // if there is an alternateConfig, it is acceptable not to be able to - // load a config, so just create an empty raw config and global - if (isset($alternateConfig)) { - $rawConfig = array(); - $globalProps = array(); - } elseif (Zend_Registry::get('configGlobal')->get('environment', 'production') === 'testing' - ) { - // it is acceptable not to be able to load a config if we are in - // testing mode, can get the config from the Zend_Registry set - // by the tests - $rawConfig = array(); - $globalProps = array(); - $alternateConfig = Zend_Registry::get('batchmake_test_config'); - } else { - throw $ze; - } - } - - // now set all the batchmake properties if we have any alternatives - $configPropertiesParamVals = array(); - if (isset($alternateConfig)) { - $configPropertiesParamVals = $alternateConfig; - // set these properties in the rawConfig - foreach ($alternateConfig as $propKey => $propVal) { - $globalProps[MIDAS_BATCHMAKE_MODULE.'.'.$propKey] = $propVal; - } - $rawConfig['global'] = $globalProps; - } - - // get out the batchmake props - $batchmakeProps = $this->filterBatchmakeConfigProperties($rawConfig); - foreach ($batchmakeProps as $configProperty => $configPropertyVal) { - $configPropertiesParamVals[$configProperty] = $configPropertyVal; - } - // set the member fields for config variables - $this->componentConfig = $configPropertiesParamVals; - $this->configScriptDir = $this->componentConfig[MIDAS_BATCHMAKE_SCRIPT_DIR_PROPERTY]; - $this->configAppDir = $this->componentConfig[MIDAS_BATCHMAKE_APP_DIR_PROPERTY]; - $this->configTmpDir = $this->componentConfig[MIDAS_BATCHMAKE_TMP_DIR_PROPERTY]; - $this->configBinDir = $this->componentConfig[MIDAS_BATCHMAKE_BIN_DIR_PROPERTY]; - $this->configDataDir = $this->componentConfig[MIDAS_BATCHMAKE_DATA_DIR_PROPERTY]; - $this->configCondorBinDir = $this->componentConfig[MIDAS_BATCHMAKE_CONDOR_BIN_DIR_PROPERTY]; - // return only batchmake or full array - if ($batchmakeOnly) { - return $this->componentConfig; - } else { - return $rawConfig; - } - } - - // above here is config setup - // below here is config testing - - /** - * @TODO from KWUtils, may need to be moved, but first tested - * checks whether the file at the passed in path has the passed in options. - */ - protected function checkFileFlag($file, $processUserUid, $options = 0x0) - { - $exist = file_exists($file); - Zend_Loader::loadClass('InternationalizationComponent', BASE_PATH.'/core/controllers/components'); - $status = ($exist ? InternationalizationComponent::translate( - MIDAS_BATCHMAKE_EXIST_STRING - ) : InternationalizationComponent::translate(MIDAS_BATCHMAKE_NOT_FOUND_ON_CURRENT_SYSTEM_STRING)); - $ret = $exist; - - if ($exist && ($options & MIDAS_BATCHMAKE_CHECK_IF_READABLE)) { - $readable = is_readable($file); - $status .= $readable ? ' / Readable' : ' / NotReadable'; - $ret = $ret && $readable; - } - - if ($exist && ($options & MIDAS_BATCHMAKE_CHECK_IF_WRITABLE)) { - $writable = is_writable($file); - $status .= $writable ? ' / Writable' : ' / NotWritable'; - $ret = $ret && $writable; - } - if ($exist && ($options & MIDAS_BATCHMAKE_CHECK_IF_EXECUTABLE)) { - $executable = is_executable($file); - $status .= $executable ? ' / Executable' : ' / NotExecutable'; - $ret = $ret && $executable; - } - if (!KWUtils::isWindows() && $exist && ($options & MIDAS_BATCHMAKE_CHECK_IF_CHMODABLE) - ) { - $chmodable = $this->IsChmodable($file, $processUserUid); - $status .= $chmodable ? ' / Chmodable' : ' / NotChmodable'; - $ret = $ret && $chmodable; - } - - return array($ret, $status); - } - - /** - * Check if current PHP process has permission to change the mode - * of $fileOrDirectory. - * - * @TODO from KWUtils, may need to be moved, but first tested - * Note: If return true, the mode of the file will be MIDAS_BATCHMAKE_DEFAULT_MKDIR_MODE - * On windows, return always True - */ - protected function isChmodable($fileOrDirectory, $processUserUid) - { - if (KWUtils::isWindows()) { - return true; - } - - if (!file_exists($fileOrDirectory)) { - Zend_Loader::loadClass('InternationalizationComponent', BASE_PATH.'/core/controllers/components'); - self::Error( - InternationalizationComponent::translate( - MIDAS_BATCHMAKE_FILE_OR_DIRECTORY_DOESNT_EXIST_STRING - ).' ['.$fileOrDirectory.']' - ); - - return false; - } - - // Get permissions of the file - // TODO On CIFS filesystem, even if the function GetFilePermissions call clearstatcache(), the value returned can be wrong - $current_perms = KWUtils::DEFAULT_MKDIR_MODE; - if ($current_perms === false) { - return false; - } - - if (is_writable($fileOrDirectory)) { - // first check on the uid of the fileOrDirectory - // if that is different than the processUserUid, then chmod - // will return false and add a warning, so let's prevent this beforehand - $fileStat = stat($fileOrDirectory); - $fileUid = $fileStat['uid']; - if ($fileUid !== $processUserUid) { - return false; - } else { - // Try to re-apply them - $return = chmod($fileOrDirectory, $current_perms); - } - } else { - $return = false; - } - - return $return; - } - - /** - * @param null|array $alternateConfigValues an alternative set of values to test, - * usually testing a possible configuration set to be saved. - * performs validation on current config setup. - * @return array - * @throws Zend_Exception - */ - public function testconfig($alternateConfigValues = null) - { - // default to correct config - $total_config_correct = 1; - $configStatus = array(); - - if ($alternateConfigValues) { - $configToTest = $alternateConfigValues; - } else { - $configToTest = $this->componentConfig; - } - - Zend_Loader::loadClass('InternationalizationComponent', BASE_PATH.'/core/controllers/components'); - - // Process web server user information - - // TODO what should be done if there are warnings?? - $processUser = posix_getpwuid(posix_geteuid()); - $processUserUid = $processUser['uid']; - $processGroup = posix_getgrgid(posix_geteuid()); - - $phpProcessString = InternationalizationComponent::translate(MIDAS_BATCHMAKE_PHP_PROCESS_STRING); - $phpProcessUserString = $phpProcessString.' '.InternationalizationComponent::translate( - MIDAS_BATCHMAKE_PHP_PROCESS_USER_STRING - ); - $phpProcessNameString = InternationalizationComponent::translate(MIDAS_BATCHMAKE_PHP_PROCESS_NAME_STRING); - $phpProcessGroupString = InternationalizationComponent::translate(MIDAS_BATCHMAKE_PHP_PROCESS_GROUP_STRING); - $phpProcessHomeString = InternationalizationComponent::translate(MIDAS_BATCHMAKE_PHP_PROCESS_HOME_STRING); - $phpProcessShellString = InternationalizationComponent::translate(MIDAS_BATCHMAKE_PHP_PROCESS_SHELL_STRING); - $unknownString = InternationalizationComponent::translate(MIDAS_BATCHMAKE_UNKNOWN_STRING); - - $phpProcessUserNameString = $phpProcessUserString.'['.$phpProcessNameString.']'; - $phpProcessUserGroupString = $phpProcessUserString.'['.$phpProcessGroupString.']'; - $phpProcessUserHomeString = $phpProcessUserString.'['.$phpProcessHomeString.']'; - $phpProcessUserShellString = $phpProcessUserString.'['.$phpProcessShellString.']'; - - $processProperties = array( - $phpProcessUserNameString => !empty($processUser[MIDAS_BATCHMAKE_PHP_PROCESS_NAME_STRING]) ? $processUser[MIDAS_BATCHMAKE_PHP_PROCESS_NAME_STRING] : '', - $phpProcessUserGroupString => !empty($processGroup[MIDAS_BATCHMAKE_PHP_PROCESS_NAME_STRING]) ? $processGroup[MIDAS_BATCHMAKE_PHP_PROCESS_NAME_STRING] : '', - $phpProcessUserHomeString => !empty($processUser[MIDAS_BATCHMAKE_DIR_KEY]) ? $processUser[MIDAS_BATCHMAKE_DIR_KEY] : '', - $phpProcessUserShellString => !empty($processUser[MIDAS_BATCHMAKE_PHP_PROCESS_SHELL_STRING]) ? $processUser[MIDAS_BATCHMAKE_PHP_PROCESS_SHELL_STRING] : '', - ); - - foreach ($processProperties as $property => $value) { - $status = !empty($value); - $configStatus[] = array( - MIDAS_BATCHMAKE_PROPERTY_KEY => $property, - MIDAS_BATCHMAKE_STATUS_KEY => $status ? $value : $unknownString, - MIDAS_BATCHMAKE_TYPE_KEY => $status ? MIDAS_BATCHMAKE_STATUS_TYPE_INFO : MIDAS_BATCHMAKE_STATUS_TYPE_WARNING, - ); - } - - foreach (self::$configPropertiesRequirements as $configProperty => $configPropertyRequirement) { - $configPropertyVal = $configToTest[$configProperty]; - if ($configPropertyVal) { - // if the property exists, check its configuration - list($result, $status) = $this->checkFileFlag( - $configPropertyVal, - $processUserUid, - $configPropertyRequirement - ); - $configStatus[] = array( - MIDAS_BATCHMAKE_PROPERTY_KEY => $configProperty, - MIDAS_BATCHMAKE_STATUS_KEY => $status, - MIDAS_BATCHMAKE_TYPE_KEY => $result ? MIDAS_BATCHMAKE_STATUS_TYPE_INFO : MIDAS_BATCHMAKE_STATUS_TYPE_ERROR, - ); - // the property is in error, therefore so is the global config - if (!$result) { - $total_config_correct = 0; - } - } else { - // property doesn't exist, both the property and global config are in error - $configStatus[] = array( - MIDAS_BATCHMAKE_PROPERTY_KEY => $configProperty, - MIDAS_BATCHMAKE_STATUS_KEY => MIDAS_BATCHMAKE_CONFIG_VALUE_MISSING, - MIDAS_BATCHMAKE_TYPE_KEY => MIDAS_BATCHMAKE_STATUS_TYPE_ERROR, - ); - $total_config_correct = 0; - } - } - - // for now assuming will run via condor, so require all of the condor setup - - foreach (self::$applicationsPaths as $app => $pathProperty) { - $appPath = $configToTest[$pathProperty].'/'.KWUtils::formatAppName($app); - list($result, $status) = $this->checkFileFlag($appPath, MIDAS_BATCHMAKE_CHECK_IF_EXECUTABLE); - $applicationString = InternationalizationComponent::translate(MIDAS_BATCHMAKE_APPLICATION_STRING); - $configStatus[] = array( - MIDAS_BATCHMAKE_PROPERTY_KEY => $applicationString.' '.$appPath, - MIDAS_BATCHMAKE_STATUS_KEY => $status, - MIDAS_BATCHMAKE_TYPE_KEY => $result ? MIDAS_BATCHMAKE_STATUS_TYPE_INFO : MIDAS_BATCHMAKE_STATUS_TYPE_ERROR, - ); - // the property is in error, therefore so is the global config - if (!$result) { - $total_config_correct = 0; - } - } - - return array($total_config_correct, $configStatus); - } - - /** - * helper method to return true if the config is correct, false otherwise. - * - * @param array $alternateConfigValues an alternative set of values to test, - * usually testing a possible configuration set to be saved. - * @return true if config correct, false otherwise - */ - public function isConfigCorrect($alternateConfigValues = null) - { - $applicationConfig = $this->testconfig($alternateConfigValues); - - return $applicationConfig[0] == 1; - } - - // above here is config testing - // below here is execution functionality - - /** - * will create a list of Batchmake scripts that exist in the MIDAS_BATCHMAKE_SCRIPT_DIR_PROPERTY - * with a .bms extension. - * - * @return array of batchmake scripts - */ - public function getBatchmakeScripts() - { - $globPattern = $this->configScriptDir.'/*'.MIDAS_BATCHMAKE_BATCHMAKE_EXTENSION; - $scripts = glob($globPattern); - $scriptNames = array(); - foreach ($scripts as $scriptPath) { - $parts = explode('/', $scriptPath); - $scriptNames[] = $parts[count($parts) - 1]; - } - - return $scriptNames; - } - - /** - * will create a new batchmake task, along with a work directory. - * - * @param type $userDao - * @return string the path to the workDir for this batchmake task - */ - public function createTask($userDao) - { - /** @var Batchmake_TaskModel $batchmakeTaskModel */ - $batchmakeTaskModel = MidasLoader::loadModel('Task', 'batchmake'); - $taskDao = $batchmakeTaskModel->createTask($userDao, $this->configTmpDir); - - return $taskDao; - } - - /** - * will look in the scriptDir for a batchmake script and symlink it to the - * workDir, will then find any batchmake scripts that need to be included - * other than a config script, and symlink them in from the scriptDir, - * and for each of these additional scripts, will perform the same - * operation (symlinking included batchmake scripts), - * will throw a Zend_Exception if any symlink fails or if a target file - * does not exist. - * - * @param $workDir the temporary work dir - * @param $scriptName the original batchmake script - * @param $processed a list of those scripts already processed - * @return the array of scripts processed - */ - public function preparePipelineScripts($workDir, $scriptName, $processed = array(), &$currentPath = array()) - { - // check for cycles - if (array_search($scriptName, $currentPath) !== false) { - throw new Zend_Exception('Cycle found in the include graph of batchmake scripts.'); - } - // push this script onto the currentPath - $currentPath[] = $scriptName; - // don't process any already processed - if (!array_key_exists($scriptName, $processed)) { - // symlink the top level scrip - $scriptLink = $workDir.'/'.$scriptName; - $scriptTarget = $this->configScriptDir.'/'.$scriptName; - if (!file_exists($scriptTarget) || !symlink($scriptTarget, $scriptLink) - ) { - throw new Zend_Exception($scriptTarget.' could not be sym-linked to '.$scriptLink); - } - // now consider this script to be processed - $processed[$scriptName] = $scriptName; - } - - // read through the script looking for includes - $contents = file_get_contents($this->configScriptDir.'/'.$scriptName); - // looking for lines like - // Include(PixelCounter.config.bms) - // /i means case insensitive search - $pattern = '/include\s*\(\s*(\S*)\s*\)/i'; - preg_match_all($pattern, $contents, $matches); - // ensure that there actually are matches - if ($matches && count($matches) > 1) { - // we just want the subpattern match, not the full match - // the subpattern match is the name of the included file - $subpatternMatches = $matches[1]; - // now that we have the matches, we only want the ones that are not .config.bms - foreach ($subpatternMatches as $includeName) { - // only want the includes that are not .config.bms scripts - if (strpos($includeName, '.config.bms') === false) { - // recursively process this script, updating the $processed list upon success - // essentially performing depth first search in a graph - // there could be a problem with a cycle in the include graph, - // so pass along the currentPath - $processed = $this->preparePipelineScripts($workDir, $includeName, $processed, $currentPath); - } - } - } - // pop this script off of the current path - array_pop($currentPath); - - // return the processed list - return $processed; - } - - /** - * will look in the $workDir for all batchmake scripts that are passed - * in the array $bmScripts, for each of these, it will find all of the apps - * included in them using the SetApp Batchmake command, and sym link the - * corresponding bmm file to the tmpDir, these bmm files are expected to be - * in the $binDir, will throw a Zend_Exception if any symlink fails or if a - * bmm file does not exist, or if one of the batchmake scripts doesn't exist. - * - * @param $workDir the temporary work dir - * @param $bmScripts the array of Batchmake scripts in the $tmpDir to process - * @return an array of [ bmmfile => bmScript where bmmfile first found ] - */ - public function preparePipelineBmms($workDir, $bmScripts) - { - // initialize the list of bmms that have been processed - $processed = array(); - foreach ($bmScripts as $bmScript) { - $scriptPath = $workDir.'/'.$bmScript; - if (!file_exists($scriptPath)) { - throw new Zend_Exception($scriptPath.' could not be found'); - } - $contents = file_get_contents($scriptPath); - // /i means case insensitive search - // read through the script looking for lines like - // SetApp(pixelCounter @PixelCounter) - $pattern = '/setapp\s*\(\s*\S*\s*@(\S*)\s*\)/i'; - preg_match_all($pattern, $contents, $matches); - // ensure that there actually are matches - if ($matches && count($matches) > 1) { - // we just want the subpattern match, not the full match - // the subpattern match is the name of the included file - $subpatternMatches = $matches[1]; - // now that we have the matches, get the app names to use for the bmm - foreach ($subpatternMatches as $appName) { - if (!array_key_exists($appName, $processed)) { - $bmmTarget = $this->configBinDir.'/'.$appName.'.bmm'; - $bmmLink = $workDir.'/'.$appName.'.bmm'; - if (!file_exists($bmmTarget) || !symlink($bmmTarget, $bmmLink) - ) { - throw new Zend_Exception($bmmTarget.' could not be sym-linked to '.$bmmLink); - } - // track which bmScript we first saw this app in - $processed[$appName] = $bmScript; - } - } - } - } - - return $processed; - } - - /** - * will check that the passed in $batchmakescript - * in the passed in $workDir will compile without errors. - * - * @param string $workDir directory where the work for SSP should be done - * @param string $bmScript name of the script, should be in $tmpDir - * @return type - */ - public function compileBatchMakeScript($workDir, $bmScript) - { - // Prepare command - $params = array('-ap', $this->configAppDir, '-p', $workDir, '-c', $workDir.$bmScript); - $cmd = KWUtils::prepareExecCommand($this->configBinDir.'/'.MIDAS_BATCHMAKE_EXE, $params); - if ($cmd === false) { - return false; - } - - // Run command - $this->executor->exec($cmd, $output, $workDir, $returnVal); - - if ($returnVal !== 0) { - throw new Zend_Exception( - 'compileBatchMakeScript: Failed to run: ['.$cmd.'], output: ['.implode(',', $output).']' - ); - } - - // if BatchMake reports errors, throw an exception - foreach ($output as $val) { - if (preg_match("/(\d+) error/", $val, $matches)) { - // number of errors is index 1, this is based on BatchMake's output - // it will output the number of errors even if 0 - if ($matches[1] == '0') { - return true; - } else { - throw new Zend_Exception( - 'compileBatchMakeScript: Compiling script ['.$bmScript.'] yielded output: ['.implode( - ',', - $output - ).']' - ); - } - } - } - - throw new Zend_Exception( - "compileBatchMakeScript: Error in BatchMake script, the compile step didn't report errors, output: [".implode( - ',', - $output - ).']' - ); - } - - /** - * will create condor scripts and a condor dag - * from the batchmake script $bmScript, in the directory $workDir. - * - * @param string $workDir - * @param string $bmScript - * @return string - * @throws Zend_Exception - */ - public function generateCondorDag($workDir, $bmScript) - { - // remove .bms if it exists, for the creation of the dagjob - if (substr($bmScript, strlen($bmScript) - strlen('.bms') === '.bms')) { - $dagName = substr($bmScript, 0, strlen($bmScript) - 4).'.dagjob'; - } else { - $dagName = $bmScript.'.dagjob'; - } - - // Prepare command - $params = array( - '-ap', - $this->configAppDir, - '-p', - $workDir, - '--condor', - $workDir.$bmScript, - $workDir.$dagName, - ); - - $cmd = KWUtils::prepareExecCommand($this->configBinDir.'/'.MIDAS_BATCHMAKE_EXE, $params); - - // Run command - $this->executor->exec($cmd, $output, $workDir, $returnVal); - - if ($returnVal !== 0) { - throw new Zend_Exception( - 'generateCondorDag: Failed to run: ['.$cmd.'], output: ['.implode(',', $output).']' - ); - } - - return $dagName; - } - - /** - * will submit the passed in $dagScript to condor, - * executing in the passed in $workDir. - * - * @param string $workDir - * @param string $dagScript - * @throws Zend_Exception - */ - public function condorSubmitDag($workDir, $dagScript) - { - // Prepare command - $params = array($dagScript); - - $cmd = KWUtils::prepareExecCommand( - $this->configCondorBinDir.'/'.MIDAS_BATCHMAKE_CONDOR_SUBMIT_DAG, - $params - ); - - // Run command - $this->executor->exec($cmd, $output, $workDir, $returnVal); - - if ($returnVal !== 0) { - throw new Zend_Exception( - 'condorSubmitDag: Failed to run: ['.$cmd.'], output: ['.implode(',', $output).']' - ); - } - } -} diff --git a/modules/batchmake/database/mysql/0.1.0.sql b/modules/batchmake/database/mysql/0.1.0.sql deleted file mode 100644 index ca1a5a5ea..000000000 --- a/modules/batchmake/database/mysql/0.1.0.sql +++ /dev/null @@ -1,34 +0,0 @@ --- Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0. - --- MySQL database for the batchmake module, version 0.1.0 - -CREATE TABLE IF NOT EXISTS `batchmake_itemmetric` ( - `itemmetric_id` bigint(20) NOT NULL AUTO_INCREMENT, - `metric_name` varchar(64) NOT NULL, - `bms_name` varchar(256) NOT NULL, - PRIMARY KEY (`itemmetric_id`) -) DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `batchmake_task` ( - `batchmake_task_id` bigint(20) NOT NULL AUTO_INCREMENT, - `user_id` bigint(20) NOT NULL, - `work_dir` text, - PRIMARY KEY (`batchmake_task_id`) -) DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `condor_dag` ( - `condor_dag_id` bigint(20) NOT NULL AUTO_INCREMENT, - `batchmake_task_id` bigint(20) NOT NULL, - `out_filename` text NOT NULL, - PRIMARY KEY (`condor_dag_id`) -) DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `condor_job` ( - `condor_job_id` bigint(20) NOT NULL AUTO_INCREMENT, - `condor_dag_id` bigint(20) NOT NULL, - `jobdefinition_filename` text NOT NULL, - `output_filename` text NOT NULL, - `error_filename` text NOT NULL, - `log_filename` text NOT NULL, - PRIMARY KEY (`condor_job_id`) -) DEFAULT CHARSET=utf8; diff --git a/modules/batchmake/database/mysql/1.0.0.sql b/modules/batchmake/database/mysql/1.0.0.sql deleted file mode 100644 index 1c056a785..000000000 --- a/modules/batchmake/database/mysql/1.0.0.sql +++ /dev/null @@ -1,36 +0,0 @@ --- Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0. - --- MySQL database for the batchmake module, version 1.0.0 - -CREATE TABLE IF NOT EXISTS `batchmake_itemmetric` ( - `itemmetric_id` bigint(20) NOT NULL AUTO_INCREMENT, - `metric_name` varchar(64) NOT NULL, - `bms_name` varchar(256) NOT NULL, - PRIMARY KEY (`itemmetric_id`) -) DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `batchmake_task` ( - `batchmake_task_id` bigint(20) NOT NULL AUTO_INCREMENT, - `user_id` bigint(20) NOT NULL, - `work_dir` text, - PRIMARY KEY (`batchmake_task_id`) -) DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `condor_dag` ( - `condor_dag_id` bigint(20) NOT NULL AUTO_INCREMENT, - `batchmake_task_id` bigint(20) NOT NULL, - `out_filename` text NOT NULL, - `dag_filename` text NOT NULL, - PRIMARY KEY (`condor_dag_id`) -) DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `condor_job` ( - `condor_job_id` bigint(20) NOT NULL AUTO_INCREMENT, - `condor_dag_id` bigint(20) NOT NULL, - `jobdefinition_filename` text NOT NULL, - `output_filename` text NOT NULL, - `error_filename` text NOT NULL, - `log_filename` text NOT NULL, - `post_filename` text NOT NULL, - PRIMARY KEY (`condor_job_id`) -) DEFAULT CHARSET=utf8; diff --git a/modules/batchmake/database/pgsql/0.1.0.sql b/modules/batchmake/database/pgsql/0.1.0.sql deleted file mode 100644 index ababde101..000000000 --- a/modules/batchmake/database/pgsql/0.1.0.sql +++ /dev/null @@ -1,33 +0,0 @@ --- Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0. - --- PostgreSQL database for the batchmake module, version 0.1.0 - -SET client_encoding = 'UTF8'; -SET default_with_oids = FALSE; - -CREATE TABLE IF NOT EXISTS "batchmake_itemmetric" ( - "itemmetric_id" serial PRIMARY KEY, - "metric_name" character varying(64) NOT NULL, - "bms_name" character varying(256) NOT NULL -); - -CREATE TABLE IF NOT EXISTS "batchmake_task" ( - "batchmake_task_id" serial PRIMARY KEY, - "user_id" bigint NOT NULL, - "work_dir" text -); - -CREATE TABLE IF NOT EXISTS "condor_dag" ( - "condor_dag_id" serial PRIMARY KEY, - "batchmake_task_id" bigint NOT NULL, - "out_filename" text NOT NULL -); - -CREATE TABLE IF NOT EXISTS "condor_job" ( - "condor_job_id" serial PRIMARY KEY, - "condor_dag_id" bigint NOT NULL, - "jobdefinition_filename" text NOT NULL, - "output_filename" text NOT NULL, - "error_filename" text NOT NULL, - "log_filename" text NOT NULL -); diff --git a/modules/batchmake/database/pgsql/1.0.0.sql b/modules/batchmake/database/pgsql/1.0.0.sql deleted file mode 100644 index 1741db755..000000000 --- a/modules/batchmake/database/pgsql/1.0.0.sql +++ /dev/null @@ -1,35 +0,0 @@ --- Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0. - --- PostgreSQL database for the batchmake module, version 1.0.0 - -SET client_encoding = 'UTF8'; -SET default_with_oids = FALSE; - -CREATE TABLE IF NOT EXISTS "batchmake_itemmetric" ( - "itemmetric_id" serial PRIMARY KEY, - "metric_name" character varying(64) NOT NULL, - "bms_name" character varying(256) NOT NULL -); - -CREATE TABLE IF NOT EXISTS "batchmake_task" ( - "batchmake_task_id" serial PRIMARY KEY, - "user_id" bigint NOT NULL, - "work_dir" text -); - -CREATE TABLE IF NOT EXISTS "condor_dag" ( - "condor_dag_id" serial PRIMARY KEY, - "batchmake_task_id" bigint NOT NULL, - "out_filename" text NOT NULL, - "dag_filename" text NOT NULL -); - -CREATE TABLE IF NOT EXISTS "condor_job" ( - "condor_job_id" serial PRIMARY KEY, - "condor_dag_id" bigint NOT NULL, - "jobdefinition_filename" text NOT NULL, - "output_filename" text NOT NULL, - "error_filename" text NOT NULL, - "log_filename" text NOT NULL, - "post_filename" text NOT NULL -); diff --git a/modules/batchmake/database/sqlite/1.0.0.sql b/modules/batchmake/database/sqlite/1.0.0.sql deleted file mode 100644 index f40bab231..000000000 --- a/modules/batchmake/database/sqlite/1.0.0.sql +++ /dev/null @@ -1,32 +0,0 @@ --- Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0. - --- SQLite database for the batchmake module, version 1.0.0 - -CREATE TABLE IF NOT EXISTS "batchmake_itemmetric" ( - "itemmetric_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, - "metric_name" TEXT NOT NULL, - "bms_name" TEXT NOT NULL -); - -CREATE TABLE IF NOT EXISTS "batchmake_task" ( - "batchmake_task_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, - "user_id" INTEGER NOT NULL, - "work_dir" TEXT -); - -CREATE TABLE IF NOT EXISTS "condor_dag" ( - "condor_dag_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, - "batchmake_task_id" INTEGER NOT NULL, - "out_filename" TEXT NOT NULL, - "dag_filename" TEXT NOT NULL -); - -CREATE TABLE IF NOT EXISTS "condor_job" ( - "condor_job_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, - "condor_dag_id" INTEGER NOT NULL, - "jobdefinition_filename" TEXT NOT NULL, - "output_filename" TEXT NOT NULL, - "error_filename" TEXT NOT NULL, - "log_filename" TEXT NOT NULL, - "post_filename" TEXT NOT NULL -); diff --git a/modules/batchmake/database/upgrade/0.2.0.php b/modules/batchmake/database/upgrade/0.2.0.php deleted file mode 100644 index 49b12a962..000000000 --- a/modules/batchmake/database/upgrade/0.2.0.php +++ /dev/null @@ -1,37 +0,0 @@ -db->query('ALTER TABLE condor_dag ADD COLUMN dag_filename text NOT NULL;'); - $this->db->query('ALTER TABLE condor_job ADD COLUMN post_filename text NOT NULL;'); - } - - /** Upgrade a PostgreSQL database. */ - public function pgsql() - { - $this->db->query('ALTER TABLE condor_dag ADD COLUMN dag_filename text NOT NULL;'); - $this->db->query('ALTER TABLE condor_job ADD COLUMN post_filename text NOT NULL;'); - } -} diff --git a/modules/batchmake/database/upgrade/1.0.0.php b/modules/batchmake/database/upgrade/1.0.0.php deleted file mode 100644 index 0d2bccbc9..000000000 --- a/modules/batchmake/database/upgrade/1.0.0.php +++ /dev/null @@ -1,24 +0,0 @@ -setName('batchmake_admin'); - $this->setMethod('POST'); - - $csrf = new Midas_Form_Element_Hash(MIDAS_BATCHMAKE_CSRF_TOKEN); - $csrf->setSalt('KZVfYdsDTzQh5T7eQDXmADfu'); - $csrf->setDecorators(array('ViewHelper')); - - $tmpDirectory = new Zend_Form_Element_Text(MIDAS_BATCHMAKE_TMP_DIR_PROPERTY); - $tmpDirectory->setLabel('BatchMake Temporary Directory'); - $tmpDirectory->setRequired(true); - $tmpDirectory->addValidator('NotEmpty', true); - - $binDirectory = new Zend_Form_Element_Text(MIDAS_BATCHMAKE_BIN_DIR_PROPERTY); - $binDirectory->setLabel('BatchMake Binary Directory'); - $binDirectory->setRequired(true); - $binDirectory->addValidator('NotEmpty', true); - - $scriptDirectory = new Zend_Form_Element_Text(MIDAS_BATCHMAKE_SCRIPT_DIR_PROPERTY); - $scriptDirectory->setLabel('BatchMake Script Directory'); - $scriptDirectory->setRequired(true); - $scriptDirectory->addValidator('NotEmpty', true); - - $appDirectory = new Zend_Form_Element_Text(MIDAS_BATCHMAKE_APP_DIR_PROPERTY); - $appDirectory->setLabel('BatchMake Application Directory'); - $appDirectory->setRequired(true); - $appDirectory->addValidator('NotEmpty', true); - - $dataDirectory = new Zend_Form_Element_Text(MIDAS_BATCHMAKE_DATA_DIR_PROPERTY); - $dataDirectory->setLabel('BatchMake Data Directory'); - $dataDirectory->setRequired(true); - $dataDirectory->addValidator('NotEmpty', true); - - $condorBinDirectory = new Zend_Form_Element_Text(MIDAS_BATCHMAKE_CONDOR_BIN_DIR_PROPERTY); - $condorBinDirectory->setLabel('Condor Binary Directory'); - $condorBinDirectory->setRequired(true); - $condorBinDirectory->addValidator('NotEmpty', true); - - $this->addDisplayGroup(array($tmpDirectory, $binDirectory, $scriptDirectory, $appDirectory, $dataDirectory, $condorBinDirectory), 'global'); - - $submit = new Zend_Form_Element_Submit(MIDAS_BATCHMAKE_SUBMIT_CONFIG); - $submit->setLabel('Save'); - - $this->addElements(array($csrf, $tmpDirectory, $binDirectory, $scriptDirectory, $appDirectory, $dataDirectory, $condorBinDirectory, $submit)); - } -} diff --git a/modules/batchmake/library/Executor.php b/modules/batchmake/library/Executor.php deleted file mode 100644 index a4fcd0eab..000000000 --- a/modules/batchmake/library/Executor.php +++ /dev/null @@ -1,43 +0,0 @@ -_name = 'condor_dag'; - $this->_daoName = 'CondorDagDao'; - $this->_key = 'condor_dag_id'; - - $this->_mainData = array( - 'condor_dag_id' => array('type' => MIDAS_DATA), - 'batchmake_task_id' => array('type' => MIDAS_DATA), - 'out_filename' => array('type' => MIDAS_DATA), - 'dag_filename' => array('type' => MIDAS_DATA), - ); - $this->initialize(); // required - } -} diff --git a/modules/batchmake/models/base/CondorJobModelBase.php b/modules/batchmake/models/base/CondorJobModelBase.php deleted file mode 100644 index f60b5adc0..000000000 --- a/modules/batchmake/models/base/CondorJobModelBase.php +++ /dev/null @@ -1,45 +0,0 @@ -_name = 'condor_job'; - $this->_daoName = 'CondorJobDao'; - $this->_key = 'condor_job_id'; - - $this->_mainData = array( - 'condor_job_id' => array('type' => MIDAS_DATA), - 'condor_dag_id' => array('type' => MIDAS_DATA), - 'jobdefinition_filename' => array('type' => MIDAS_DATA), - 'output_filename' => array('type' => MIDAS_DATA), - 'error_filename' => array('type' => MIDAS_DATA), - 'log_filename' => array('type' => MIDAS_DATA), - 'post_filename' => array('type' => MIDAS_DATA), - ); - $this->initialize(); // required - } -} diff --git a/modules/batchmake/models/base/ItemmetricModelBase.php b/modules/batchmake/models/base/ItemmetricModelBase.php deleted file mode 100644 index 03e1763c6..000000000 --- a/modules/batchmake/models/base/ItemmetricModelBase.php +++ /dev/null @@ -1,72 +0,0 @@ -_name = 'batchmake_itemmetric'; - $this->_key = 'itemmetric_id'; - - $this->_mainData = array( - 'itemmetric_id' => array('type' => MIDAS_DATA), - 'metric_name' => array('type' => MIDAS_DATA), - 'bms_name' => array('type' => MIDAS_DATA), - ); - $this->initialize(); // required - } - - /** - * Create an item metric. - * - * @param string $metricName - * @param string $bmsName - * @return Batchmake_ItemmetricDao - * @throws Zend_Exception if an item metric already exists with this metric name - */ - public function createItemmetric($metricName, $bmsName) - { - /** @var Batchmake_ItemmetricDao $itemmetric */ - $itemmetric = MidasLoader::newDao('ItemmetricDao', 'batchmake'); - - // make sure one isn't already there by this name - $found = $this->findBy('metric_name', $metricName); - if (isset($found) && count($found) > 0) { - // don't allow the creation, as we have a metric of this name already - throw new Zend_Exception('An Itemmetric already exists with that name'); - } - - $itemmetric->setMetricName($metricName); - $itemmetric->setBmsName($bmsName); - $this->save($itemmetric); - - return $itemmetric; - } - - /** - * Get all rows stored. - * - * @return array - */ - abstract public function getAll(); -} diff --git a/modules/batchmake/models/base/TaskModelBase.php b/modules/batchmake/models/base/TaskModelBase.php deleted file mode 100644 index 13f7434de..000000000 --- a/modules/batchmake/models/base/TaskModelBase.php +++ /dev/null @@ -1,69 +0,0 @@ -_name = 'batchmake_task'; - $this->_key = 'batchmake_task_id'; - - $this->_mainData = array( - 'batchmake_task_id' => array('type' => MIDAS_DATA), - 'user_id' => array('type' => MIDAS_DATA), - 'work_dir' => array('type' => MIDAS_DATA), - ); - $this->initialize(); // required - } - - /** - * Create a task. - * - * @param UserDao $userDao - * @param string $tmpWorkDirRoot - * @return Batchmake_TaskDao - * @throws Zend_Exception - */ - public function createTask($userDao, $tmpWorkDirRoot) - { - if (!$userDao instanceof UserDao) { - throw new Zend_Exception('Error parameters.'); - } - - /** @var Batchmake_TaskDao $task */ - $task = MidasLoader::newDao('TaskDao', 'batchmake'); - $task->setUserId($userDao->getKey()); - $this->save($task); - $userId = $task->getUserId(); - $taskId = $task->getKey(); - $subdirs = array(MIDAS_BATCHMAKE_SSP_DIR, $userId, $taskId); - // create a workDir based on the task and user - $workDir = KWUtils::createSubDirectories($tmpWorkDirRoot.'/', $subdirs); - $task->setWorkDir($workDir); - $this->save($task); - - return $task; - } -} diff --git a/modules/batchmake/models/dao/CondorDagDao.php b/modules/batchmake/models/dao/CondorDagDao.php deleted file mode 100644 index 319e3220f..000000000 --- a/modules/batchmake/models/dao/CondorDagDao.php +++ /dev/null @@ -1,40 +0,0 @@ -database->getAll('Itemmetric', 'batchmake'); - - return $rowsetDAOs; - } -} diff --git a/modules/batchmake/models/pdo/TaskModel.php b/modules/batchmake/models/pdo/TaskModel.php deleted file mode 100644 index 7d3a61193..000000000 --- a/modules/batchmake/models/pdo/TaskModel.php +++ /dev/null @@ -1,26 +0,0 @@ -setupDatabase(array('default')); - $this->_daos = array('User'); - $this->_models = array('User'); - $this->enabledModules = array('batchmake'); - parent::setUp(); - } - - /** Test index action. */ - public function testIndexAction() - { - // first try to bring up the page without logging in, should get an exception - $usersFile = $this->loadData('User', 'default'); - $nullUserDao = null; - - /** @var UserDao $userDao */ - foreach ($usersFile as $userDao) { - if ($userDao->getFirstname() === 'Admin') { - $adminUserDao = $userDao; - } elseif ($userDao->getFirstname() === 'FirstName1') { - $nonAdminUserDao = $userDao; - } - } - - $withException = true; - $page = '/batchmake/admin/index'; - $this->params = array(); - $this->getRequest()->setMethod('GET'); - $this->dispatchUrl($page, $nullUserDao, $withException); - - // now login with a non-admin account, should get an exception - $this->resetAll(); - $this->params = array(); - $this->getRequest()->setMethod('GET'); - $this->dispatchUrl($page, $nonAdminUserDao, $withException); - - // now login with an admin account - $this->resetAll(); - $this->params = array(); - $this->getRequest()->setMethod('GET'); - $this->dispatchUrl($page, $adminUserDao); - - $body = $this->getBody(); - - $this->assertModule('batchmake'); - $this->assertController('admin'); - $this->assertAction('index'); - - if (strpos($body, 'BatchMake Module Configuration') === false) { - $this->fail('Unable to find the body element'); - } - - $this->assertQuery('form'); - } -} diff --git a/modules/batchmake/tests/controllers/CMakeLists.txt b/modules/batchmake/tests/controllers/CMakeLists.txt deleted file mode 100644 index 66446aa84..000000000 --- a/modules/batchmake/tests/controllers/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -#============================================================================= -# Midas Server -# Copyright Kitware SAS, 26 rue Louis Guérin, 69100 Villeurbanne, France. -# All rights reserved. -# For more information visit http://www.kitware.com/. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -set(module_name batchmake) -to_titlecase(${module_name} module_name_titlecase) - -add_subdirectory(components) - -add_midas_test(${module_name_titlecase}AdminController AdminControllerTest.php) -add_midas_test(${module_name_titlecase}IndexController IndexControllerTest.php) diff --git a/modules/batchmake/tests/controllers/ControllerTestCase.php b/modules/batchmake/tests/controllers/ControllerTestCase.php deleted file mode 100644 index 4184e07df..000000000 --- a/modules/batchmake/tests/controllers/ControllerTestCase.php +++ /dev/null @@ -1,142 +0,0 @@ -setupAndGetConfig(); - Zend_Registry::set('batchmake_test_config', $testConfigProps); - } - - /** - * function will create a temporary batchmake config, copying over test data - * to the the locations in that config needed for the tests, returning an - * array of config property names to directory locations. - * - * @todo figure out a way to copy over Batchmake or else mock it - * @return array - * @throws Zend_Exception - */ - public function setupAndGetConfig() - { - // create a test batchmake setup in the temp dir - // and initialize test data - $tmpDir = $this->getTempDirectory(); - $subDirs = array('batchmake', 'tests'); - KWUtils::createSubDirectories($tmpDir.'/', $subDirs); - $configProps = array( - MIDAS_BATCHMAKE_TMP_DIR_PROPERTY => $tmpDir.'/batchmake/tests/tmp', - MIDAS_BATCHMAKE_BIN_DIR_PROPERTY => $tmpDir.'/batchmake/tests/bin', - MIDAS_BATCHMAKE_SCRIPT_DIR_PROPERTY => $tmpDir.'/batchmake/tests/script', - MIDAS_BATCHMAKE_APP_DIR_PROPERTY => $tmpDir.'/batchmake/tests/bin', - MIDAS_BATCHMAKE_DATA_DIR_PROPERTY => $tmpDir.'/batchmake/tests/data', - MIDAS_BATCHMAKE_CONDOR_BIN_DIR_PROPERTY => $tmpDir.'/batchmake/tests/condorbin', - ); - // now make sure these dirs exist - // later can actually add some stuff to these dirs - foreach ($configProps as $dir) { - if (!file_exists($dir) && !KWUtils::mkDir($dir)) { - throw new Zend_Exception("couldn't create dir ".$dir); - } - } - - // now copy over the bms files - $srcDir = BASE_PATH.'modules/batchmake/tests/testfiles/script'; - $targetDir = $configProps[MIDAS_BATCHMAKE_SCRIPT_DIR_PROPERTY]; - $extension = '.bms'; - $this->symlinkFileset($srcDir, $targetDir, $extension); - - // and now the bmms - $srcDir = BASE_PATH.'modules/batchmake/tests/testfiles/bin'; - $targetDir = $configProps[MIDAS_BATCHMAKE_APP_DIR_PROPERTY]; - $extension = '.bmm'; - $this->symlinkFileset($srcDir, $targetDir, $extension); - - // the mock object strategy requires both an interface and for - // executable files to exist on disk in a particular location, - // so here we will create symlinks to a known executable - // ls - // which should be on most systems - - $params = array('ls'); - $cmd = KWUtils::prepareExeccommand('which', $params); - // dir doesn't matter, just send in srcDir as it is convenient - KWUtils::exec($cmd, $output, $srcDir, $returnVal); - if ($returnVal !== 0 || !isset($output) || !isset($output[0])) { - throw new Zend_Exception('Problem finding ls on your system, used for testing'); - } - $pathToLs = $output[0]; - - // get the applications and their path properties from the component that - // expects them - $applicationsPaths = Batchmake_KWBatchmakeComponent::getApplicationsPaths(); - foreach ($applicationsPaths as $application => $pathProperty) { - // now in the place of each executable, symlink the ls exe - $link = $configProps[$pathProperty].'/'.$application; - if (!file_exists($link) && !symlink($pathToLs, $link)) { - throw new Zend_Exception($pathToLs.' could not be sym-linked to '.$link); - } - } - - return $configProps; - } - - /** - * looks in the srcDir, finds all files ending with $extension, and - * symlinks them to targetDir if there isn't already a file there - * by that name. - * - * @param string $srcDir - * @param string $targetDir - * @param string $extension - * @throws Zend_Exception - */ - protected function symlinkFileset($srcDir, $targetDir, $extension) - { - // open the directory - $handle = opendir($srcDir); - if (!is_readable($srcDir)) { - throw new Zend_Exception("can't read ".$srcDir); - } - // and scan through the items inside - while (false !== ($item = readdir($handle))) { - // make sure item matches extension - if ((strpos($item, $extension) == strlen($item) - 4)) { - // link the file if it is not already there - $scriptTarget = $srcDir.'/'.$item; - $scriptLink = $targetDir.'/'.$item; - if (!file_exists($scriptLink) && !symlink($scriptTarget, $scriptLink) - ) { - throw new Zend_Exception($scriptTarget.' could not be sym-linked to '.$scriptLink); - } - } - } - closedir($handle); - } -} diff --git a/modules/batchmake/tests/controllers/IndexControllerTest.php b/modules/batchmake/tests/controllers/IndexControllerTest.php deleted file mode 100644 index 9cecccfdb..000000000 --- a/modules/batchmake/tests/controllers/IndexControllerTest.php +++ /dev/null @@ -1,45 +0,0 @@ -setupDatabase(array('default')); - $this->enabledModules = array('batchmake'); - parent::setUp(); - } - - /** test index action */ - public function testIndexAction() - { - // for now just get the page - $page = '/batchmake/index/index'; - $this->params = array(); - $this->getRequest()->setMethod('GET'); - $this->dispatchUrl($page); - } -} diff --git a/modules/batchmake/tests/controllers/components/CMakeLists.txt b/modules/batchmake/tests/controllers/components/CMakeLists.txt deleted file mode 100644 index bf2b1d76f..000000000 --- a/modules/batchmake/tests/controllers/components/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -#============================================================================= -# Midas Server -# Copyright Kitware SAS, 26 rue Louis Guérin, 69100 Villeurbanne, France. -# All rights reserved. -# For more information visit http://www.kitware.com/. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -set(module_name batchmake) -to_titlecase(${module_name} module_name_titlecase) - -add_midas_test(${module_name_titlecase}KWBatchmakeComponent KWBatchmakeComponentTest.php) -add_midas_test(${module_name_titlecase}ExecuteComponent ExecuteComponentTest.php) diff --git a/modules/batchmake/tests/controllers/components/ExecuteComponentTest.php b/modules/batchmake/tests/controllers/components/ExecuteComponentTest.php deleted file mode 100644 index a49a983be..000000000 --- a/modules/batchmake/tests/controllers/components/ExecuteComponentTest.php +++ /dev/null @@ -1,200 +0,0 @@ -setupDatabase(array('default')); - $this->_models = array('User', 'Item', 'Bitstream'); - $this->_components = array('Export', 'Upload'); - $this->enabledModules = array('batchmake', 'api'); - $this->cwd = getcwd(); - parent::setUp(); - if (!isset($this->executeComponent)) { - require_once BASE_PATH.'/modules/batchmake/controllers/components/ExecuteComponent.php'; - $this->executeComponent = new Batchmake_ExecuteComponent(); - } - if (!isset($this->kwBatchmakeComponent)) { - require_once BASE_PATH.'/modules/batchmake/controllers/components/KWBatchmakeComponent.php'; - require_once BASE_PATH.'/modules/batchmake/tests/library/ExecutorMock.php'; - $executor = new Batchmake_ExecutorMock(); - $this->kwBatchmakeComponent = new Batchmake_KWBatchmakeComponent($this->setupAndGetConfig(), $executor); - } - - // upload a file for testing of the exports - $tmpDir = $this->getTempDirectory().'/'.$this->testTmpDir; - // use UploadComponent - require_once BASE_PATH.'/core/controllers/components/UploadComponent.php'; - $uploadComponent = new UploadComponent(); - // notifier is required in ItemRevisionModelBase::addBitstream, create a fake one - Zend_Registry::set('notifier', new MIDAS_Notifier(false, null)); - // create a directory for testing the export component - if (file_exists($tmpDir)) { - if (!KWUtils::recursiveRemoveDirectory($tmpDir)) { - throw new Zend_Exception($tmpDir.' already exists and cannot be deleted.'); - } - } - if (!mkdir($tmpDir)) { - throw new Zend_Exception('Cannot create directory: '.$tmpDir); - } - chmod($tmpDir, 0777); - - // upload an item to user1's public folder - $user1_public_path = $tmpDir.'/public.file'; - copy(BASE_PATH.'/tests/testfiles/search.png', $user1_public_path); - $user1_public_fh = fopen($user1_public_path, 'a+'); - fwrite($user1_public_fh, 'content:user1_public'); - fclose($user1_public_fh); - $user1_public_filename = 'public.file'; - $usersFile = $this->loadData('User', 'default'); - $userDao = $this->User->load($usersFile[0]->getKey()); - $user1_public_parent = '1001'; - $license = 0; - $this->tmpItem = $uploadComponent->createUploadedItem( - $userDao, - $user1_public_filename, - $user1_public_path, - $user1_public_parent, - $license, - '', - true - ); - - parent::setUp(); - } - - /** clean up after tests */ - public function tearDown() - { - // remove the temporary tests dir - $tmpDir = $this->getTempDirectory().'/'.$this->testTmpDir; - - KWUtils::recursiveRemoveDirectory($tmpDir); - $this->Item->delete($this->tmpItem); - // change the current dir back to the saved cwd after each test - chdir($this->cwd); - } - - /** - * tests that a list of items gets correctly exported to a batchmake work dir. - */ - public function testExportItemsToWorkDataDir() - { - $usersFile = $this->loadData('User', 'default'); - $userDao = $this->User->load($usersFile[0]->getKey()); - $taskDao = $this->kwBatchmakeComponent->createTask($userDao); - $workDir = $taskDao->getWorkDir(); - $itemIds = array($this->tmpItem->getItemId()); - $this->executeComponent->exportItemsToWorkDataDir($userDao, $taskDao, $itemIds); - // check that the exported file now exists on the file system - $this->assertTrue( - file_exists($workDir.'/data/'.$itemIds[0].'/'.$this->tmpItem->getName()), - 'exported item should exist' - ); - } - - /** - * tests that a list of items gets correctly exported to a batchmake work dir, - * and returns a path to the exported items. - */ - public function testExportSingleBitstreamItemsToWorkDataDir() - { - $usersFile = $this->loadData('User', 'default'); - $userDao = $this->User->load($usersFile[0]->getKey()); - $taskDao = $this->kwBatchmakeComponent->createTask($userDao); - $workDir = $taskDao->getWorkDir(); - $items = array($this->tmpItem->getName() => $this->tmpItem->getItemId()); - $exportedItems = $this->executeComponent->exportSingleBitstreamItemsToWorkDataDir($userDao, $taskDao, $items); - // check that the exported file now exists on the file system - $expectedExportPath = $workDir.'/data/'.$this->tmpItem->getItemId().'/'.$this->tmpItem->getName(); - $this->assertTrue(file_exists($expectedExportPath), 'exported item should exist'); - // ensure that the name of the returned item is the same as the passed in - foreach ($exportedItems as $itemName => $exportedPath) { - $this->assertEquals($itemName, $this->tmpItem->getName(), 'Item names should be equal.'); - $this->assertEquals($exportedPath, $expectedExportPath, 'Expected export path does not match actual.'); - } - } - - /** - * tests that a python config file will be generated in the batchmake work dir. - */ - public function testGeneratePythonConfigParams() - { - $usersFile = $this->loadData('User', 'default'); - $userDao = $this->User->load($usersFile[0]->getKey()); - $taskDao = $this->kwBatchmakeComponent->createTask($userDao); - $workDir = $taskDao->getWorkDir(); - - // need to falsify a webroot for this test - $fakeWebroot = 'fake_web_root'; - Zend_Registry::set('webroot', $fakeWebroot); - // need to falsify a HTTP_HOST - $_SERVER['HTTP_HOST'] = 'localhost'; - // need to create a web api-key for the user - /** @var UserapiModel $userapiModel */ - $userapiModel = MidasLoader::loadModel('Userapi'); - $userapiModel->createDefaultApiKey($userDao); - - $this->executeComponent->generatePythonConfigParams($taskDao, $userDao); - $expectedConfigPath = $workDir.'/config.cfg'; - $this->assertTrue(file_exists($expectedConfigPath), 'exported config file should exist'); - - $this->executeComponent->generatePythonConfigParams($taskDao, $userDao, 'admin'); - $expectedConfigPath = $workDir.'/adminconfig.cfg'; - $this->assertTrue(file_exists($expectedConfigPath), 'exported admin config file should exist'); - - // un-falsify, re-truth? - Zend_Registry::set('webroot', null); - unset($_SERVER['HTTP_HOST']); - } - - /** - * tests that a python config file will be generated in the batchmake work dir. - */ - public function testGenerateBatchmakeConfig() - { - $usersFile = $this->loadData('User', 'default'); - $userDao = $this->User->load($usersFile[0]->getKey()); - $taskDao = $this->kwBatchmakeComponent->createTask($userDao); - $workDir = $taskDao->getWorkDir(); - - $configScriptStem = 'test'; - $this->executeComponent->generateBatchmakeConfig( - $taskDao, - array('prop' => 'val'), - 'script.py', - 'dagscript.py', - $configScriptStem - ); - $expectedConfigPath = $workDir.'/'.$configScriptStem.'.config.bms'; - $this->assertTrue(file_exists($expectedConfigPath), 'batchmake config file should exist'); - } -} diff --git a/modules/batchmake/tests/controllers/components/KWBatchmakeComponentTest.php b/modules/batchmake/tests/controllers/components/KWBatchmakeComponentTest.php deleted file mode 100644 index d7d8165c4..000000000 --- a/modules/batchmake/tests/controllers/components/KWBatchmakeComponentTest.php +++ /dev/null @@ -1,401 +0,0 @@ -setupDatabase(array('default')); - $this->_models = array('User'); - $this->enabledModules = array('batchmake'); - $this->cwd = getcwd(); - parent::setUp(); - if (!isset($this->kwBatchmakeComponent)) { - require_once BASE_PATH.'/modules/batchmake/controllers/components/KWBatchmakeComponent.php'; - require_once BASE_PATH.'/modules/batchmake/tests/library/ExecutorMock.php'; - $executor = new Batchmake_ExecutorMock(); - $this->kwBatchmakeComponent = new Batchmake_KWBatchmakeComponent($this->setupAndGetConfig(), $executor); - } - } - - /** clean up after tests */ - public function tearDown() - { - // remove the temporary tests dir - $testTmpDir = $this->getTempDirectory().'/batchmake/tests'; - - KWUtils::recursiveRemoveDirectory($testTmpDir); - // change the current dir back to the saved cwd after each test - chdir($this->cwd); - } - - /** - * tests config setup, relies on an alternate testing config to be defined, - * these properties should all point to the batchmake module testfiles dirs. - */ - public function testIsConfigCorrect() - { - // start out with known correct set - $this->assertTrue($this->kwBatchmakeComponent->isConfigCorrect()); - - // now make a change to something that shouldn't work - $badConfigVals = $this->setupAndGetConfig(); - $badConfigVals[MIDAS_BATCHMAKE_DATA_DIR_PROPERTY] = '/unlikely/to/work/right'; - $badKwBatchmakeComponent = new Batchmake_KWBatchmakeComponent($badConfigVals); - $this->assertFalse($badKwBatchmakeComponent->isConfigCorrect()); - } - - /** - * tests that all the bmScripts that have been entered for testing are found. - */ - public function testGetBatchmakeScripts() - { - $foundTestScripts = $this->kwBatchmakeComponent->getBatchmakeScripts(); - sort($foundTestScripts); - $expectedTestScripts = array( - 'CompileEmptyOutput.bms', - 'CompileReturnNonzero.bms', - 'Compiles.bms', - 'Myscript2.bms', - 'noscripts.bms', - 'anotherscript.bms', - 'anotherscriptwitherrors.bms', - 'bmmswitherrors.bms', - 'cycle1.bms', - 'cycle31.bms', - 'cycle32.bms', - 'cycle33.bms', - 'nocycle1.bms', - 'nocycle2.bms', - 'nocycle3.bms', - 'myscript.bms', - 'PixelCounter.bms', - 'CompileErrors.bms', - ); - sort($expectedTestScripts); - $this->assertEquals($foundTestScripts, $expectedTestScripts); - } - - /** - * helper function to clear out any files in a directory. - */ - protected function clearDirFiles($dirToClear) - { - foreach (scandir($dirToClear) as $filename) { - if ($filename && $filename != '.' && $filename != '..') { - unlink($dirToClear.'/'.$filename); - } - } - } - - /** - * helper function to run a test case. - */ - protected function preparePipelineScriptsTestcase($workDir, $scriptName, $expectedSet) - { - // clear the directory of any existing files - $this->clearDirFiles($workDir); - - // try symlinking all the batchmake files starting with $scriptName - $bmScriptsProcessed = $this->kwBatchmakeComponent->preparePipelineScripts($workDir, $scriptName); - - // check that the correct batchmake scripts are there, and only those - // easiest just to add '.' and '..' to expected list - $expectedSet[] = '..'; - $expectedSet[] = '.'; - sort($expectedSet); - - $foundScripts = scandir($workDir); - sort($foundScripts); - - $this->assertEquals( - $expectedSet, - $foundScripts, - 'Expected batchmake scripts not found rooted from '.$scriptName - ); - - // add in '.' and '..' - $bmScriptsProcessed[] = '.'; - $bmScriptsProcessed[] = '..'; - sort($bmScriptsProcessed); - - // also check that the set of scripts returned from the method is this same set - $this->assertEquals( - $expectedSet, - $bmScriptsProcessed, - 'Expected batchmake scripts not equal to those returned from processing '.$scriptName - ); - } - - /** - * helper function to run a test case that is expected to throw an exception. - */ - protected function preparePipelineScriptsTestcaseException($workDir, $scriptName) - { - try { - // need to suppress error output to keep test from failing, despite exception being caught - @$this->kwBatchmakeComponent->preparePipelineScripts($workDir, $scriptName); - $this->fail('Expected an exception for $scriptName, but did not get one.'); - } catch (Zend_Exception $ze) { - // if we got here, this is the correct behavior - $this->assertTrue(true); - } - } - - /** tests preparePipelineScripts, and exercises createTask. */ - public function testPreparePipelineScripts() - { - $usersFile = $this->loadData('User', 'default'); - $userDao = $this->User->load($usersFile[0]->getKey()); - $taskDao = $this->kwBatchmakeComponent->createTask($userDao); - $workDir = $taskDao->getWorkDir(); - - $scriptName = 'anotherscript.bms'; - $expectedSet = array( - 'myscript.bms', - 'Myscript2.bms', - 'anotherscript.bms', - 'noscripts.bms', - 'PixelCounter.bms', - ); - $this->preparePipelineScriptsTestcase($workDir, $scriptName, $expectedSet); - - $scriptName = 'noscripts.bms'; - $expectedSet = array('noscripts.bms'); - $this->preparePipelineScriptsTestcase($workDir, $scriptName, $expectedSet); - - // try symlinking all the batchmake files starting with anotherscriptwitherrors.bms - // expect an exception, as this script includes a non-existent script - $scriptName = 'anotherscriptwitherrors.bms'; - $this->preparePipelineScriptsTestcaseException($workDir, $scriptName); - - // cycle detection tests - - // check a script with no cycle,1->2, 1->3, 3->2 - // clear the directory of the symlinked files - $scriptName = 'nocycle1.bms'; - $expectedSet = array('nocycle1.bms', 'nocycle2.bms', 'nocycle3.bms'); - $this->preparePipelineScriptsTestcase($workDir, $scriptName, $expectedSet); - - // expect an exception, as this script has a simple cycle - // 1->1 - $scriptName = 'cycle1.bms'; - $this->preparePipelineScriptsTestcaseException($workDir, $scriptName); - - // check a script with a more complex cycle, 1->2, 1->3, 2->3, 3->2 - $scriptName = 'cycle31.bms'; - $this->preparePipelineScriptsTestcaseException($workDir, $scriptName); - } - - /** tests preparePipelineBmms */ - public function testPreparePipelineBmms() - { - $usersFile = $this->loadData('User', 'default'); - $userDao = $this->User->load($usersFile[0]->getKey()); - $taskDao = $this->kwBatchmakeComponent->createTask($userDao); - $workDir = $taskDao->getWorkDir(); - - // try a script that refers to a non-existant bmm - $scriptName = 'bmmswitherrors.bms'; - $bmScripts = $this->kwBatchmakeComponent->preparePipelineScripts($workDir, $scriptName); - try { - $this->kwBatchmakeComponent->preparePipelineBmms($workDir, $bmScripts); - $this->fail('Expected an exception for '.$scriptName.', but did not get one.'); - } catch (Zend_Exception $ze) { - // if we got here, this is the correct behavior - $this->assertTrue(true); - } - - // now try symlinking all the batchmake files starting with anotherscript.bms - $scriptName = 'anotherscript.bms'; - $bmScripts_anotherscript = $this->kwBatchmakeComponent->preparePipelineScripts($workDir, $scriptName); - $bmms = $this->kwBatchmakeComponent->preparePipelineBmms($workDir, $bmScripts_anotherscript); - // these come as [ name of app => script where found ] - // convert them to a form useful for comparison - $processedBmms_anotherscript = array(); - foreach ($bmms as $bmm => $script) { - $processedBmms_anotherscript[] = $bmm.'.bmm'; - } - sort($processedBmms_anotherscript); - - $globOutput = glob($workDir.'/*.bmm'); - // strip off the path - $foundBmms_anotherscript = array(); - foreach ($globOutput as $bmm) { - $foundBmms_anotherscript[] = basename($bmm); - } - sort($foundBmms_anotherscript); - - $expectedBmms_anotherscript = array( - 'AnotherApp.bmm', - 'MyApp2.bmm', - 'PixelCounter.bmm', - 'TestApp1.bmm', - 'TestApp2.bmm', - 'myapp.bmm', - ); - sort($expectedBmms_anotherscript); - - // compare the three arrays - $this->assertEquals( - $processedBmms_anotherscript, - $expectedBmms_anotherscript, - 'BMMs: processed != expected, for anotherscript.bms' - ); - $this->assertEquals( - $processedBmms_anotherscript, - $foundBmms_anotherscript, - 'BMMs: processed != found, for anotherscript.bms' - ); - } - - /** tests testCompileBatchMakeScript */ - public function testCompileBatchMakeScript() - { - $usersFile = $this->loadData('User', 'default'); - $userDao = $this->User->load($usersFile[0]->getKey()); - $taskDao = $this->kwBatchmakeComponent->createTask($userDao); - $workDir = $taskDao->getWorkDir(); - - // a script that compiles - $scriptName = 'Compiles.bms'; - $bmScripts = $this->kwBatchmakeComponent->preparePipelineScripts($workDir, $scriptName); - $this->kwBatchmakeComponent->preparePipelineBmms($workDir, $bmScripts); - - // this one should work - $this->kwBatchmakeComponent->compileBatchMakeScript($workDir, $scriptName); - - // now try a script that doesn't compile but returns errors - $scriptName = 'CompileErrors.bms'; - $bmScripts = $this->kwBatchmakeComponent->preparePipelineScripts($workDir, $scriptName); - $this->kwBatchmakeComponent->preparePipelineBmms($workDir, $bmScripts); - try { - $this->kwBatchmakeComponent->compileBatchMakeScript($workDir, $scriptName); - $this->fail('Should have had a compile error but did not, testCompileBatchMakeScript'); - } catch (Zend_Exception $ze) { - // if we got here, this is the correct behavior - // check that the exception came from the right place - $this->assertEquals(1, preg_match('/compileBatchMakeScript/', $ze->getMessage())); - } - - // now try a script that returns a non-zero value from the compile step - $scriptName = 'CompileReturnNonzero.bms'; - $bmScripts = $this->kwBatchmakeComponent->preparePipelineScripts($workDir, $scriptName); - $this->kwBatchmakeComponent->preparePipelineBmms($workDir, $bmScripts); - try { - $this->kwBatchmakeComponent->compileBatchMakeScript($workDir, $scriptName); - $this->fail('Should have had a compile error but did not, testCompileBatchMakeScript'); - } catch (Zend_Exception $ze) { - // if we got here, this is the correct behavior - // check that the exception came from the right place - $this->assertEquals(1, preg_match('/compileBatchMakeScript/', $ze->getMessage())); - } - - // a script that returns a zero value but an empty output from the compile step - $scriptName = 'CompileEmptyOutput.bms'; - $bmScripts = $this->kwBatchmakeComponent->preparePipelineScripts($workDir, $scriptName); - $this->kwBatchmakeComponent->preparePipelineBmms($workDir, $bmScripts); - try { - $this->kwBatchmakeComponent->compileBatchMakeScript($workDir, $scriptName); - $this->fail('Should have had a compile error but did not, testCompileBatchMakeScript'); - } catch (Zend_Exception $ze) { - // if we got here, this is the correct behavior - // check that the exception came from the right place - $this->assertEquals(1, preg_match('/compileBatchMakeScript/', $ze->getMessage())); - } - } - - /** tests generateCondorDag */ - public function testGenerateCondorDag() - { - $usersFile = $this->loadData('User', 'default'); - $userDao = $this->User->load($usersFile[0]->getKey()); - $taskDao = $this->kwBatchmakeComponent->createTask($userDao); - $workDir = $taskDao->getWorkDir(); - - // try a script that returns a non-zero value - $scriptName = 'CompileReturnNonzero.bms'; - $bmScripts = $this->kwBatchmakeComponent->preparePipelineScripts($workDir, $scriptName); - $this->kwBatchmakeComponent->preparePipelineBmms($workDir, $bmScripts); - try { - $this->kwBatchmakeComponent->generateCondorDag($workDir, $scriptName); - $this->fail('Should have had an error but did not, testGenerateCondorDag'); - } catch (Zend_Exception $ze) { - // if we got here, this is the correct behavior - // check that the exception came from the right place - $this->assertEquals(1, preg_match('/generateCondorDag/', $ze->getMessage())); - } - - // a script that compiles - $scriptName = 'Compiles.bms'; - $bmScripts = $this->kwBatchmakeComponent->preparePipelineScripts($workDir, $scriptName); - $this->kwBatchmakeComponent->preparePipelineBmms($workDir, $bmScripts); - - // try to generate the Condor script - $dagJobFile = $this->kwBatchmakeComponent->generateCondorDag($workDir, $scriptName); - $this->assertEquals($dagJobFile, 'Compiles.dagjob'); - // check that dag files and condor job files were created - $condorFiles = array($dagJobFile, 'Compiles.1.dagjob', 'Compiles.3.dagjob', 'Compiles.5.dagjob'); - foreach ($condorFiles as $condorFile) { - $this->assertFileExists($workDir.'/'.$condorFile); - } - } - - /** tests function testCondorSubmitDag */ - public function testCondorSubmitDag() - { - $usersFile = $this->loadData('User', 'default'); - $userDao = $this->User->load($usersFile[0]->getKey()); - $taskDao = $this->kwBatchmakeComponent->createTask($userDao); - $workDir = $taskDao->getWorkDir(); - - // try a script that returns a non-zero value - $scriptName = 'CompileReturnNonzero.dagjob'; - try { - $this->kwBatchmakeComponent->condorSubmitDag($workDir, $scriptName); - $this->fail('Should have had an error but did not, testCondorSubmitDag'); - } catch (Zend_Exception $ze) { - // if we got here, this is the correct behavior - // check that the exception came from the right place - $this->assertEquals(1, preg_match('/condorSubmitDag/', $ze->getMessage())); - } - - // a script that compiles - $scriptName = 'Compiles.bms'; - $bmScripts = $this->kwBatchmakeComponent->preparePipelineScripts($workDir, $scriptName); - $this->kwBatchmakeComponent->preparePipelineBmms($workDir, $bmScripts); - - $dagScript = $this->kwBatchmakeComponent->generateCondorDag($workDir, $scriptName); - $this->kwBatchmakeComponent->condorSubmitDag($workDir, $dagScript); - // how to check this now? - // TODO think about this some more - // perhaps send something back through the web-api - // what would that be testing exactly? - } -} diff --git a/modules/batchmake/tests/databaseDataset/default.xml b/modules/batchmake/tests/databaseDataset/default.xml deleted file mode 100644 index 9ceb29a74..000000000 --- a/modules/batchmake/tests/databaseDataset/default.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/modules/batchmake/tests/library/BatchmakeMock.php b/modules/batchmake/tests/library/BatchmakeMock.php deleted file mode 100644 index 56fbd6484..000000000 --- a/modules/batchmake/tests/library/BatchmakeMock.php +++ /dev/null @@ -1,188 +0,0 @@ -compileFlag.'/', $command)) { - $this->execCompile($command, $output, $chdir, $return_val); - } elseif (preg_match('/'.$this->generateDagFlag.'/', $command)) { - $this->execGenerateCondorDag($command, $output, $chdir, $return_val); - } else { - throw new Zend_Exception('unexepected BatchMake command flag:'.$command); - } - } - - /** - * handler function with same interface as KWUtils.exec to simulate the - * -c functionality of the BatchMake executable. - * - * @param type $command - * @param type $output - * @param type $chdir - * @param type $return_val - * @return type - */ - public function execCompile($command, &$output = null, $chdir = '', &$return_val = null) - { - // all test cases should have the proper syntax, verify this - if (!preg_match('/(.*)BatchMake(.*)\-ap(.*)\-p(.*)\-c(.*)/', $command, $matches) - ) { - throw new Zend_Exception('malformed BatchMake compile command'); - } - - // now perform particular logic to each of the 4 test cases - $scriptnameParts = explode('/', $matches[5]); - $scriptName = $scriptnameParts[count($scriptnameParts) - 1]; - - if (preg_match('/CompileErrors.bms/', $scriptName)) { - $return_val = 0; - $output = array('1 error', '1'); - } elseif (preg_match('/CompileReturnNonzero.bms/', $scriptName)) { - $return_val = -1; - $output = array('1 error', '1'); - } elseif (preg_match('/CompileEmptyOutput.bms/', $scriptName)) { - $return_val = 0; - $output = array(); - } elseif (preg_match('/Compiles.bms/', $scriptName)) { - $return_val = 0; - $output = array('0 error', '10'); - } else { - throw new Zend_Exception('Unexpected BatchMake test script: '.$scriptName); - } - } - - /** - * handler function with same interface as KWUtils.exec to simulate the - * --condor functionality of the BatchMake executable. - * - * @param string $command - * @param null|mixed $output - * @param string $chdir - * @param null|mixed $return_val - * @throws Zend_Exception - */ - public function execGenerateCondorDag($command, &$output = null, $chdir = '', &$return_val = null) - { - // all test cases should have the proper syntax, verify this - if (!preg_match('/(.*)BatchMake(.*)\-ap.*\'(\S*)\'.*\-p.*\'(\S*)\'.*\--condor(.*)/', $command, $matches) - ) { - throw new Zend_Exception('malformed BatchMake compile command'); - } - - // last two parts of the command are bms name and dag name - $interestedParts = $matches[5]; - $filenames = explode(' ', $interestedParts); - $scriptName = $filenames[1]; - - if (preg_match('/CompileReturnNonzero.bms/', $scriptName)) { - $return_val = -1; - $output = array('1 error', '1'); - } elseif (preg_match("/'(.*)Compiles.bms'/", $scriptName, $scriptMatch)) { - // do a bit of "Compile" type checking - // check that the ap exists - $ap = $matches[3]; - if (!is_dir($ap)) { - // here we simulate compiler errors - $return_val = 0; - $output = array('1 error can not find '.$ap, '1'); - - return; - } - // Compiles.bms refs PixelCounter, ensure PixelCounter.bmm exists in ap - if (!file_exists($ap.'/PixelCounter.bmm')) { - // here we simulate compiler errors - $return_val = 0; - $output = array('1 error can not find '.$ap.'/PixelCounter.bmm', '1'); - - return; - } - // check that the p exists - $p = $matches[4]; - if (!is_dir($p)) { - // here we simulate compiler errors - $return_val = 0; - $output = array('1 error can not find '.$p, '1'); - - return; - } - // check that the dagDir exists - $dagDir = $scriptMatch[1]; - if (!is_dir($dagDir)) { - // here we simulate compiler errors - $return_val = 0; - $output = array('1 error can not find '.$dagDir, '1'); - - return; - } - // check that the bms exists - $bmsScript = $dagDir.'/Compiles.bms'; - if (!file_exists($bmsScript)) { - // here we simulate compiler errors - $return_val = 0; - $output = array('1 error can not find '.$bmsScript, '1'); - - return; - } - // now create the needed dagfiles in it - $condorFiles = array('Compiles.dagjob', 'Compiles.1.dagjob', 'Compiles.3.dagjob', 'Compiles.5.dagjob'); - foreach ($condorFiles as $condorFile) { - $filePath = $dagDir.'/'.$condorFile; - // create a blank file - $asciifile = fopen($filePath, 'w'); - fclose($asciifile); - } - $return_val = 0; - $output = array(); - } else { - throw new Zend_Exception('Unexpected BatchMake test script: '.$scriptName); - } - } -} diff --git a/modules/batchmake/tests/library/CondorSubmitDagMock.php b/modules/batchmake/tests/library/CondorSubmitDagMock.php deleted file mode 100644 index da5e94168..000000000 --- a/modules/batchmake/tests/library/CondorSubmitDagMock.php +++ /dev/null @@ -1,75 +0,0 @@ -mockExes = array(); - include_once BASE_PATH.'/modules/batchmake/tests/library/BatchmakeMock.php'; - $this->mockExes[MIDAS_BATCHMAKE_EXE] = new Batchmake_BatchmakeMock(); - include_once BASE_PATH.'/modules/batchmake/tests/library/CondorSubmitDagMock.php'; - $this->mockExes[MIDAS_BATCHMAKE_CONDOR_SUBMIT_DAG] = new Batchmake_CondorSubmitDagMock(); - // not yet implemented - // and if we do implement them, double check the matching logic - // since condor_submit will match condor_submit_dag - //$this->mockExes[MIDAS_BATCHMAKE_CONDOR_SUBMIT] = null; - //$this->mockExes[MIDAS_BATCHMAKE_CONDOR_QUEUE] = null; - //$this->mockExes[MIDAS_BATCHMAKE_CONDOR_STATUS] = null; - } - - /** - * exec method with the same interface as that in KWUtils, will check the - * command and intercept it if it is a known command with a Mock object - * that should be used for testing, otherwise it will pass it on to KWUtils. - * - * @param type $command - * @param type $output - * @param type $chdir - * @param type $return_val - */ - public function exec($command, &$output = null, $chdir = '', &$return_val = null) - { - $matched = false; - foreach ($this->mockExes as $exeName => $mockExe) { - if (preg_match('/'.$exeName.'/', $command)) { - $matched = true; - $mockExe->exec($command, $output, $chdir, $return_val); - } - } - if (!$matched) { - KWUtils::exec($command, $output, $chdir, $return_val); - } - } -} diff --git a/modules/batchmake/tests/models/CMakeLists.txt b/modules/batchmake/tests/models/CMakeLists.txt deleted file mode 100644 index 6500624d0..000000000 --- a/modules/batchmake/tests/models/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -#============================================================================= -# Midas Server -# Copyright Kitware SAS, 26 rue Louis Guérin, 69100 Villeurbanne, France. -# All rights reserved. -# For more information visit http://www.kitware.com/. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -add_subdirectory(base) diff --git a/modules/batchmake/tests/models/base/CMakeLists.txt b/modules/batchmake/tests/models/base/CMakeLists.txt deleted file mode 100644 index f6e9eebf8..000000000 --- a/modules/batchmake/tests/models/base/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -#============================================================================= -# Midas Server -# Copyright Kitware SAS, 26 rue Louis Guérin, 69100 Villeurbanne, France. -# All rights reserved. -# For more information visit http://www.kitware.com/. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#============================================================================= - -set(module_name batchmake) -to_titlecase(${module_name} module_name_titlecase) - -add_midas_test(${module_name_titlecase}ItemmetricModel ItemmetricModelTest.php) -add_midas_test(${module_name_titlecase}TaskModel TaskModelTest.php) diff --git a/modules/batchmake/tests/models/base/ItemmetricModelTest.php b/modules/batchmake/tests/models/base/ItemmetricModelTest.php deleted file mode 100644 index 201bb0512..000000000 --- a/modules/batchmake/tests/models/base/ItemmetricModelTest.php +++ /dev/null @@ -1,110 +0,0 @@ -enabledModules = array('batchmake'); - parent::setUp(); - $this->setupDatabase(array('default'), 'batchmake'); // module dataset - $db = Zend_Registry::get('dbAdapter'); - $configDatabase = Zend_Registry::get('configDatabase'); - if ($configDatabase->database->adapter == 'PDO_PGSQL') { - $db->query( - "SELECT setval('batchmake_itemmetric_itemmetric_id_seq', (SELECT MAX(itemmetric_id) FROM batchmake_itemmetric)+1);" - ); - } - } - - /** Test that ItemmetricModel::createTask($userDao) works */ - public function testCreateItemmetric() - { - /** @var Batchmake_ItemmetricModel $itemmetricModel */ - $itemmetricModel = MidasLoader::loadModel('Itemmetric', 'batchmake'); - - // create an itemmetric - $metricName = 'metrictest1'; - $bmsName = 'metrictest1.bms'; - $itemmetric1Dao = $itemmetricModel->createItemmetric($metricName, $bmsName); - // check the dao is correct - $this->assertNotEmpty($itemmetric1Dao); - $this->assertTrue($itemmetric1Dao instanceof Batchmake_ItemmetricDao); - // check that what we passed in is what we got out - $this->assertEquals($metricName, $itemmetric1Dao->getMetricName()); - $this->assertEquals($bmsName, $itemmetric1Dao->getBmsName()); - // now try to retrieve it by key - $key = $itemmetric1Dao->getKey(); - $dupDao = $itemmetricModel->load($key); - $this->assertTrue($itemmetricModel->compareDao($itemmetric1Dao, $dupDao)); - - // now try creating another one with the same name, see that it fails - try { - $itemmetricModel->createItemmetric($metricName, $bmsName); - $this->fail('Expected an exception for '.$metricName.', but did not get one.'); - } catch (Zend_Exception $ze) { - // if we got here, this is the correct behavior - $this->assertTrue(true); - } - - // be sure we can create one with a different name - $metricName2 = 'metrictest2'; - $bmsName2 = 'metrictest2.bms'; - $itemmetricDao2 = $itemmetricModel->createItemmetric($metricName2, $bmsName2); - // check the dao is correct - $this->assertNotEmpty($itemmetricDao2); - $this->assertTrue($itemmetricDao2 instanceof Batchmake_ItemmetricDao); - // check that what we passed in is what we got out - $this->assertEquals($metricName2, $itemmetricDao2->getMetricName()); - $this->assertEquals($bmsName2, $itemmetricDao2->getBmsName()); - // now try to retrieve it by key - $key = $itemmetricDao2->getKey(); - $dupDao = $itemmetricModel->load($key); - $this->assertTrue($itemmetricModel->compareDao($itemmetricDao2, $dupDao)); - } - - /** - * tests getAll abstract function. - */ - public function testGetAll() - { - $itemmetricFileDaos = $this->loadData('Itemmetric', 'default', 'batchmake', 'batchmake'); - - /** @var Batchmake_ItemmetricModel $itemmetricModel */ - $itemmetricModel = MidasLoader::loadModel('Itemmetric', 'batchmake'); - $modelDaos = $itemmetricModel->getAll(); - - // now check that each of the itemmetrics in the file are loaded as daos - foreach ($itemmetricFileDaos as $fileDao) { - $found = false; - foreach ($modelDaos as $modelDao) { - if ($itemmetricModel->compareDao($modelDao, $fileDao)) { - $found = true; - break; - } - } - if (!$found) { - $this->fail('Did not find a testdata itemmetric , with getAll'); - } - } - } -} diff --git a/modules/batchmake/tests/models/base/TaskModelTest.php b/modules/batchmake/tests/models/base/TaskModelTest.php deleted file mode 100644 index 93d1f38c4..000000000 --- a/modules/batchmake/tests/models/base/TaskModelTest.php +++ /dev/null @@ -1,81 +0,0 @@ -enabledModules = array('batchmake'); - parent::setUp(); - $this->setupDatabase(array('default'), 'batchmake'); // module dataset - } - - /** Test that TaskModel::createTask($userDao) works */ - public function testCreateTask() - { - $usersFile = $this->loadData('User', 'default', '', 'batchmake'); - - /** @var Batchmake_TaskModel $taskModel */ - $taskModel = MidasLoader::loadModel('Task', 'batchmake'); - - $user1Dao = $usersFile[0]; - - $tmpWorkDirRoot = $this->getTempDirectory().'/'.'test'; - KWUtils::mkDir($tmpWorkDirRoot); - - $task1Dao = $taskModel->createTask($user1Dao, $tmpWorkDirRoot); - - $this->assertNotEmpty($task1Dao); - $this->assertTrue($task1Dao instanceof Batchmake_TaskDao); - $userId1 = $task1Dao->getUserId(); - $this->assertTrue(is_numeric($userId1)); - $this->assertFalse(is_object($userId1)); - $this->assertEquals($userId1, $user1Dao->getUserId()); - $taskId1 = $task1Dao->getKey(); - $this->assertTrue(is_numeric($taskId1)); - $this->assertFalse(is_object($taskId1)); - - // now try a different user - $user2Dao = $usersFile[1]; - - $task2Dao = $taskModel->createTask($user2Dao, $tmpWorkDirRoot); - $this->assertNotEmpty($task2Dao); - $this->assertTrue($task2Dao instanceof Batchmake_TaskDao); - $userId2 = $task2Dao->getUserId(); - $this->assertTrue(is_numeric($userId2)); - $this->assertFalse(is_object($userId2)); - $this->assertEquals($userId2, $user2Dao->getUserId()); - $taskId2 = $task2Dao->getKey(); - $this->assertTrue(is_numeric($taskId2)); - $this->assertFalse(is_object($taskId2)); - - // make sure each of the tasks got a different id - $this->assertNotEquals($taskId1, $taskId2); - - // now try to retrieve it by key - $task3Dao = $taskModel->load($taskId1); - $this->assertTrue($taskModel->compareDao($task1Dao, $task3Dao)); - - $task4Dao = $taskModel->load($taskId2); - $this->assertTrue($taskModel->compareDao($task2Dao, $task4Dao)); - } -} diff --git a/modules/batchmake/tests/testfiles/bin/AnotherApp.bmm b/modules/batchmake/tests/testfiles/bin/AnotherApp.bmm deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/batchmake/tests/testfiles/bin/MyApp2.bmm b/modules/batchmake/tests/testfiles/bin/MyApp2.bmm deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/batchmake/tests/testfiles/bin/PixelCounter.bmm b/modules/batchmake/tests/testfiles/bin/PixelCounter.bmm deleted file mode 100644 index 65dfbc38c..000000000 --- a/modules/batchmake/tests/testfiles/bin/PixelCounter.bmm +++ /dev/null @@ -1,58 +0,0 @@ - - 1.0 - - PixelCounter - Not defined - SET_PATH_TO/PixelCounter - - - 4 - filename - - 0 - 1 - 0 - - - 3 - threshold - - 0 - 0 - 0 - - - 1 - GenerateMetaOutput - -generateMetaOutput - 0 - 0 - 1 - - - 1 - GenerateXMLMetaOutput - -oxml - 0 - 0 - 1 - - - 1 - GenerateXMLFile - -ofxml - 0 - 0 - 1 - - - 4 - GenerateXMLFile.GenerateXMLFile - - 3 - 2 - 0 - - - - diff --git a/modules/batchmake/tests/testfiles/bin/TestApp1.bmm b/modules/batchmake/tests/testfiles/bin/TestApp1.bmm deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/batchmake/tests/testfiles/bin/TestApp2.bmm b/modules/batchmake/tests/testfiles/bin/TestApp2.bmm deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/batchmake/tests/testfiles/bin/myapp.bmm b/modules/batchmake/tests/testfiles/bin/myapp.bmm deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/batchmake/tests/testfiles/script/CompileEmptyOutput.bms b/modules/batchmake/tests/testfiles/script/CompileEmptyOutput.bms deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/batchmake/tests/testfiles/script/CompileErrors.bms b/modules/batchmake/tests/testfiles/script/CompileErrors.bms deleted file mode 100644 index f5034a295..000000000 --- a/modules/batchmake/tests/testfiles/script/CompileErrors.bms +++ /dev/null @@ -1,7 +0,0 @@ -# Should the script end in case of errors -ExitOnError(1) - -Echo('This script should not compile') - -Foreach(var ${varlist}) -Endforeach() diff --git a/modules/batchmake/tests/testfiles/script/CompileReturnNonzero.bms b/modules/batchmake/tests/testfiles/script/CompileReturnNonzero.bms deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/batchmake/tests/testfiles/script/Compiles.bms b/modules/batchmake/tests/testfiles/script/Compiles.bms deleted file mode 100644 index 993eceee3..000000000 --- a/modules/batchmake/tests/testfiles/script/Compiles.bms +++ /dev/null @@ -1,22 +0,0 @@ -# Should the script end in case of errors -ExitOnError(1) - -# all params are hardcoded, just used to check for creating a dagjob and condor scripts - -SetApp(pixelCounter @PixelCounter) -SetAppOption(pixelCounter.threshold 10) -SetAppOption(pixelCounter.GenerateXMLFile 1) - -Set(hardcodedlist 'sphere_5.mha' 'sphere_10.mha' 'sphere_15.mha') - -# Generic script options -Foreach(file ${hardcodedlist}) - GetFilename(stem ${file} NAME_WITHOUT_EXTENSION) - - SetAppOption(pixelCounter.filename ${file}) - SetAppOption(pixelCounter.GenerateXMLFile.GenerateXMLFile ${stem}.xml) - - # Run the application - Run(prog_output ${pixelCounter}) - -Endforeach(file) diff --git a/modules/batchmake/tests/testfiles/script/Myscript2.bms b/modules/batchmake/tests/testfiles/script/Myscript2.bms deleted file mode 100644 index 7060b5967..000000000 --- a/modules/batchmake/tests/testfiles/script/Myscript2.bms +++ /dev/null @@ -1,25 +0,0 @@ -# Should the script end in case of errors -ExitOnError(1) - -# Imported parameters: cfg_input_directory, cfg_output_directory, cfg_application_directory, cfg_threshold -Include(PixelCounter.config.bms) - -# Application setup -SetApp(pixelCounter @PixelCounter) -SetApp(myapp2 @MyApp2) -SetAppOption(pixelCounter.threshold ${cfg_threshold}) -SetAppOption(pixelCounter.GenerateXMLFile 1) - - -# Generic script options -Foreach(file ${cfg_input_cart}) - GetFilename(stem ${file} NAME_WITHOUT_EXTENSION) - - SetAppOption(pixelCounter.filename ${file}) - SetAppOption(pixelCounter.GenerateXMLFile.GenerateXMLFile ${stem}.${cfg_output1}.xml) - - # Run the application - CondorPostScript(pixelCounter ${cfg_condorpostscript} ${cfg_midas_baseURL} ${cfg_itemid} ${cfg_email} ${cfg_appname} ${cfg_apikey} ${cfg_output_directory} ${stem}.${cfg_output1}.xml) - Run(prog_output ${pixelCounter}) - -Endforeach(file) diff --git a/modules/batchmake/tests/testfiles/script/PixelCounter.bms b/modules/batchmake/tests/testfiles/script/PixelCounter.bms deleted file mode 100644 index 8c4b44a89..000000000 --- a/modules/batchmake/tests/testfiles/script/PixelCounter.bms +++ /dev/null @@ -1,24 +0,0 @@ -# Should the script end in case of errors -ExitOnError(1) - -# Imported parameters: cfg_input_directory, cfg_output_directory, cfg_application_directory, cfg_threshold -Include(PixelCounter.config.bms) - -# Application setup -SetApp(pixelCounter @PixelCounter) -SetAppOption(pixelCounter.threshold ${cfg_threshold}) -SetAppOption(pixelCounter.GenerateXMLFile 1) - - -# Generic script options -Foreach(file ${cfg_input_cart}) - GetFilename(stem ${file} NAME_WITHOUT_EXTENSION) - - SetAppOption(pixelCounter.filename ${file}) - SetAppOption(pixelCounter.GenerateXMLFile.GenerateXMLFile ${stem}.${cfg_output1}.xml) - - # Run the application - CondorPostScript(pixelCounter ${cfg_condorpostscript} ${cfg_midas_baseURL} ${cfg_itemid} ${cfg_email} ${cfg_appname} ${cfg_apikey} ${cfg_output_directory} ${stem}.${cfg_output1}.xml) - Run(prog_output ${pixelCounter}) - -Endforeach(file) diff --git a/modules/batchmake/tests/testfiles/script/anotherscript.bms b/modules/batchmake/tests/testfiles/script/anotherscript.bms deleted file mode 100644 index 52f80ca78..000000000 --- a/modules/batchmake/tests/testfiles/script/anotherscript.bms +++ /dev/null @@ -1,28 +0,0 @@ -# Should the script end in case of errors -ExitOnError(1) - -# Imported parameters: cfg_input_directory, cfg_output_directory, cfg_application_directory, cfg_threshold -Include(PixelCounter.config.bms) -Include(PixelCounter.bms) -Include(myscript.bms) -Include(Myscript2.bms) - -# Application setup -SetApp(pixelCounter @PixelCounter) -SetApp(anotherapp @AnotherApp) -SetAppOption(pixelCounter.threshold ${cfg_threshold}) -SetAppOption(pixelCounter.GenerateXMLFile 1) - - -# Generic script options -Foreach(file ${cfg_input_cart}) - GetFilename(stem ${file} NAME_WITHOUT_EXTENSION) - - SetAppOption(pixelCounter.filename ${file}) - SetAppOption(pixelCounter.GenerateXMLFile.GenerateXMLFile ${stem}.${cfg_output1}.xml) - - # Run the application - CondorPostScript(pixelCounter ${cfg_condorpostscript} ${cfg_midas_baseURL} ${cfg_itemid} ${cfg_email} ${cfg_appname} ${cfg_apikey} ${cfg_output_directory} ${stem}.${cfg_output1}.xml) - Run(prog_output ${pixelCounter}) - -Endforeach(file) diff --git a/modules/batchmake/tests/testfiles/script/anotherscriptwitherrors.bms b/modules/batchmake/tests/testfiles/script/anotherscriptwitherrors.bms deleted file mode 100644 index 3bac9507d..000000000 --- a/modules/batchmake/tests/testfiles/script/anotherscriptwitherrors.bms +++ /dev/null @@ -1,25 +0,0 @@ -# Should the script end in case of errors -ExitOnError(1) - -# Imported parameters: cfg_input_directory, cfg_output_directory, cfg_application_directory, cfg_threshold -Include(nonexistentscript.bms) - -# Application setup -SetApp(pixelCounter @PixelCounter) -SetApp(anotherapp @AnotherApp) -SetAppOption(pixelCounter.threshold ${cfg_threshold}) -SetAppOption(pixelCounter.GenerateXMLFile 1) - - -# Generic script options -Foreach(file ${cfg_input_cart}) - GetFilename(stem ${file} NAME_WITHOUT_EXTENSION) - - SetAppOption(pixelCounter.filename ${file}) - SetAppOption(pixelCounter.GenerateXMLFile.GenerateXMLFile ${stem}.${cfg_output1}.xml) - - # Run the application - CondorPostScript(pixelCounter ${cfg_condorpostscript} ${cfg_midas_baseURL} ${cfg_itemid} ${cfg_email} ${cfg_appname} ${cfg_apikey} ${cfg_output_directory} ${stem}.${cfg_output1}.xml) - Run(prog_output ${pixelCounter}) - -Endforeach(file) diff --git a/modules/batchmake/tests/testfiles/script/bmmswitherrors.bms b/modules/batchmake/tests/testfiles/script/bmmswitherrors.bms deleted file mode 100644 index 095f1eb08..000000000 --- a/modules/batchmake/tests/testfiles/script/bmmswitherrors.bms +++ /dev/null @@ -1,23 +0,0 @@ -# Should the script end in case of errors -ExitOnError(1) - - -# Application setup -SetApp(testapp1 @NoApp) -SetApp(testapp2 @TestApp2) -SetAppOption(pixelCounter.threshold ${cfg_threshold}) -SetAppOption(pixelCounter.GenerateXMLFile 1) - - -# Generic script options -Foreach(file ${cfg_input_cart}) - GetFilename(stem ${file} NAME_WITHOUT_EXTENSION) - - SetAppOption(pixelCounter.filename ${file}) - SetAppOption(pixelCounter.GenerateXMLFile.GenerateXMLFile ${stem}.${cfg_output1}.xml) - - # Run the application - CondorPostScript(pixelCounter ${cfg_condorpostscript} ${cfg_midas_baseURL} ${cfg_itemid} ${cfg_email} ${cfg_appname} ${cfg_apikey} ${cfg_output_directory} ${stem}.${cfg_output1}.xml) - Run(prog_output ${pixelCounter}) - -Endforeach(file) diff --git a/modules/batchmake/tests/testfiles/script/cycle1.bms b/modules/batchmake/tests/testfiles/script/cycle1.bms deleted file mode 100644 index 11a3048ea..000000000 --- a/modules/batchmake/tests/testfiles/script/cycle1.bms +++ /dev/null @@ -1 +0,0 @@ -Include(cycle1.bms) diff --git a/modules/batchmake/tests/testfiles/script/cycle31.bms b/modules/batchmake/tests/testfiles/script/cycle31.bms deleted file mode 100644 index ca1f270a3..000000000 --- a/modules/batchmake/tests/testfiles/script/cycle31.bms +++ /dev/null @@ -1,2 +0,0 @@ -Include(cycle32.bms) -Include(cycle33.bms) diff --git a/modules/batchmake/tests/testfiles/script/cycle32.bms b/modules/batchmake/tests/testfiles/script/cycle32.bms deleted file mode 100644 index 0f5ca2cd0..000000000 --- a/modules/batchmake/tests/testfiles/script/cycle32.bms +++ /dev/null @@ -1 +0,0 @@ -Include(cycle33.bms) diff --git a/modules/batchmake/tests/testfiles/script/cycle33.bms b/modules/batchmake/tests/testfiles/script/cycle33.bms deleted file mode 100644 index 235b67832..000000000 --- a/modules/batchmake/tests/testfiles/script/cycle33.bms +++ /dev/null @@ -1 +0,0 @@ -Include(cycle32.bms) diff --git a/modules/batchmake/tests/testfiles/script/myscript.bms b/modules/batchmake/tests/testfiles/script/myscript.bms deleted file mode 100644 index a3474c8f4..000000000 --- a/modules/batchmake/tests/testfiles/script/myscript.bms +++ /dev/null @@ -1,26 +0,0 @@ -# Should the script end in case of errors -ExitOnError(1) - -# Imported parameters: cfg_input_directory, cfg_output_directory, cfg_application_directory, cfg_threshold -Include(PixelCounter.config.bms) -Include(noscripts.bms) - -# Application setup -SetApp(pixelCounter @PixelCounter) -SetApp(myapp @myapp) -SetAppOption(pixelCounter.threshold ${cfg_threshold}) -SetAppOption(pixelCounter.GenerateXMLFile 1) - - -# Generic script options -Foreach(file ${cfg_input_cart}) - GetFilename(stem ${file} NAME_WITHOUT_EXTENSION) - - SetAppOption(pixelCounter.filename ${file}) - SetAppOption(pixelCounter.GenerateXMLFile.GenerateXMLFile ${stem}.${cfg_output1}.xml) - - # Run the application - CondorPostScript(pixelCounter ${cfg_condorpostscript} ${cfg_midas_baseURL} ${cfg_itemid} ${cfg_email} ${cfg_appname} ${cfg_apikey} ${cfg_output_directory} ${stem}.${cfg_output1}.xml) - Run(prog_output ${pixelCounter}) - -Endforeach(file) diff --git a/modules/batchmake/tests/testfiles/script/nocycle1.bms b/modules/batchmake/tests/testfiles/script/nocycle1.bms deleted file mode 100644 index 239a97411..000000000 --- a/modules/batchmake/tests/testfiles/script/nocycle1.bms +++ /dev/null @@ -1,2 +0,0 @@ -Include(nocycle2.bms) -Include(nocycle3.bms) diff --git a/modules/batchmake/tests/testfiles/script/nocycle2.bms b/modules/batchmake/tests/testfiles/script/nocycle2.bms deleted file mode 100644 index a763c6d87..000000000 --- a/modules/batchmake/tests/testfiles/script/nocycle2.bms +++ /dev/null @@ -1 +0,0 @@ -Echo('nothing to say') diff --git a/modules/batchmake/tests/testfiles/script/nocycle3.bms b/modules/batchmake/tests/testfiles/script/nocycle3.bms deleted file mode 100644 index a78bec42d..000000000 --- a/modules/batchmake/tests/testfiles/script/nocycle3.bms +++ /dev/null @@ -1 +0,0 @@ -Include(nocycle2.bms) diff --git a/modules/batchmake/tests/testfiles/script/noscripts.bms b/modules/batchmake/tests/testfiles/script/noscripts.bms deleted file mode 100644 index bdba1abd2..000000000 --- a/modules/batchmake/tests/testfiles/script/noscripts.bms +++ /dev/null @@ -1,23 +0,0 @@ -# Should the script end in case of errors -ExitOnError(1) - - -# Application setup -SetApp(testapp1 @TestApp1) -SetApp(testapp2 @TestApp2) -SetAppOption(pixelCounter.threshold ${cfg_threshold}) -SetAppOption(pixelCounter.GenerateXMLFile 1) - - -# Generic script options -Foreach(file ${cfg_input_cart}) - GetFilename(stem ${file} NAME_WITHOUT_EXTENSION) - - SetAppOption(pixelCounter.filename ${file}) - SetAppOption(pixelCounter.GenerateXMLFile.GenerateXMLFile ${stem}.${cfg_output1}.xml) - - # Run the application - CondorPostScript(pixelCounter ${cfg_condorpostscript} ${cfg_midas_baseURL} ${cfg_itemid} ${cfg_email} ${cfg_appname} ${cfg_apikey} ${cfg_output_directory} ${stem}.${cfg_output1}.xml) - Run(prog_output ${pixelCounter}) - -Endforeach(file) diff --git a/modules/batchmake/views/admin/index.phtml b/modules/batchmake/views/admin/index.phtml deleted file mode 100644 index c4a14fd55..000000000 --- a/modules/batchmake/views/admin/index.phtml +++ /dev/null @@ -1,29 +0,0 @@ -declareVars('form', 'pageTitle'); -$this->headTitle($this->escape($this->pageTitle)); -?> - -
    -

    escape($this->pageTitle); ?>

    - form; ?> -

    « Back to Modules Administration

    -
    diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 07eecd0e4..b61e860a4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -13,11 +13,6 @@ modules/archive/tests - modules/cleanup/tests