Ejemplo n.º 1
0
 * @author niuyunkun(niuyunkun@baidu.com)
 * @date 2013/08/30 14:09:43
 * @version $Revision$ 
 * @brief 
 *  
 **/
#require_once( "./Base.php") ;
require_once "./Init.php";
//初始化
$strApp = $argv[1];
$strPipelet = $argv[2];
list($tmp, $app) = explode("=", $strApp);
list($tmp, $pipelet) = explode("=", $strPipelet);
$init = new ETL_Init();
$init->init($argc, $argv);
$arrAppConf = $init->getAppConf();
$dataPath = ETL_DATA . $app;
define('MODULE', $app);
while (true) {
    //检查待上传文件,push到队列中
    exec("cd {$dataPath} && ls {$app}_{$pipelet}_*", $dir, $ret);
    $arrFileToUpload = array();
    foreach ($dir as $key => $file) {
        if (preg_match("/^({$app}_{$pipelet}_\\d{12})\$/", $file, $arrMatch)) {
            $arrFileToUpload[$arrMatch[1]] = '';
        } else {
            if (preg_match("/^({$app}_{$pipelet}_\\d{12})\\.done\$/", $file, $arrMatch)) {
                $arrFileToUpload[$arrMatch[1]] = "done";
            }
        }
    }