dial::JobId submit(string appname="atlasreco", string dstname ="rdotest1") { string tskxml = "task_" + appname + ".xml"; // Invalidate the job ID. jid = JobId(); // Select dataset from DSC and extract from DDB. // For more information and links to query and browse catalogs, see // http://www.usatlas.bnl.gov/~dladams/dataset/atlas_catalogs DatasetId did = dsc.id(dstname); if ( ! did.is_valid() ) { cout << "Unable to find dataset " << dstname << " in DSC" << endl; return jid; } const dset::Dataset* pdst = dr.extract(did); if ( pdst == 0 ) { cout << "Unable to find dataset " << did.to_string() << " in DDB" << endl; return jid; } const dset::Dataset& dst = *pdst; if ( ! dst.is_valid() ) { cout << "Invalid dataset" << endl; return jid; } // Select application. dial::Application app(appname, "0.94"); // Define names for task files. dial::Task::TextList ttnames; if ( appname == "atlasreco" ) { //cout << "Application aodhisto is not yet supported " << endl; //ttnames.push_back(Text("AnalysisSkeleton_jobOptions.py")); } else { cout << "Unknown application: " << appname << endl; return jid; } // If task XML does not exist, create it from the task files. if ( ! FileStatus(tskxml).exists() ) { cout << "*** Creating task" << endl; dial::Task newtsk(ttnames); XmlElement* pxnewtsk = newtsk.xml(); if ( pxnewtsk == 0 ) { cout << "Unable to create new task XML" << endl; cout << newtsk << endl; return jid; } parser.write(tskxml, *pxnewtsk); } if ( ! FileStatus(tskxml).exists() ) { cout << "Error creating task" << endl; } const XmlElement* pxtsk = parser.parse(tskxml); dial::Task tsk(*pxtsk); if ( ! tsk.is_valid() ) { cout << "Task is invalid" << endl; return jid; } // Install task. // Use XML description if it is present. If not, create a // new task from the code and result. bool tstat = msch.has_task(app, tsk); if ( tstat ) { cout << "*** Task is already installed" << endl; } else { cout << "*** Installing task" << endl; cout << " This should be quick..." << endl; tstat = msch.add_task(app, tsk); if ( ! tstat ) { cout << "Unable to install task " << tsk.id() << endl; if ( msch.xml_name() == string("MasterScheduler") ) { const dial::MasterScheduler* pmsch = dynamic_cast(&msch); if ( pmsch != 0 ) { cout << pmsch->slave().log() << endl; } } return jid; } cout << " Task installation complete" << endl; } // Submit job. cout << "*** Submitting job" << endl; jid = msch.submit(app, tsk, dst); dial::Job& job = msch.job(jid); // Check job status. cout << "*** Submitted job status:" << endl; if ( jid.is_valid() ) { cout << job << endl; } else { cout << "Job submission failed" << endl; cout << msch.log() << endl; } return jid; }