stat and get added
authorTamas Jung <tamasjung@gmail.com>
Tue, 26 Oct 2010 11:43:57 +0000 (13:43 +0200)
committerTamas Jung <tamasjung@gmail.com>
Tue, 26 Oct 2010 11:43:57 +0000 (13:43 +0200)
ruby/test.rb
src/arc_libs.h
src/arcclientc.cpp
src/arcclientc.h
src/logger.h
src/submit.cpp [deleted file]
src/submit.h [deleted file]

index 3ede909..10aeff2 100644 (file)
@@ -5,7 +5,8 @@ ENV["ARC_LOCATION"] = "/opt/local"
 
 jobdesc = File.read "/Users/tamas/quick/arc/arex/simple.jsdl"
 args = [""] #optparser cuts the first arg
-args += "-c ARC1:https://localhost:60000/arex -e".split
+#args += "-c ARC1:https://localhost:60000/arex -e".split
+args << "-e"
 args << jobdesc
 
 module ArcClientCLibrary
index 3866fca..78e4326 100644 (file)
@@ -22,7 +22,9 @@
 #include <arc/XMLNode.h>
 #include <arc/client/Submitter.h>
 #include <arc/client/TargetGenerator.h>
+#include <arc/client/JobController.h>
 #include <arc/client/JobDescription.h>
+#include <arc/client/JobSupervisor.h>
 #include <arc/UserConfig.h>
 #include <arc/client/Broker.h>
 
index 21125c3..9366562 100644 (file)
@@ -24,7 +24,7 @@ char* initialize(){
        
        logcerr.setFormat(Arc::ShortFormat);
        Arc::Logger::getRootLogger().addDestination(logcerr);
-       Arc::Logger::getRootLogger().setThreshold(Arc::DEBUG);
+       Arc::Logger::getRootLogger().setThreshold(Arc::ERROR);
        
        
        return new_str(ARCCLIENTC_VERSION);
index 4f3ae4a..7ac775e 100644 (file)
@@ -11,7 +11,6 @@
 #define arcclientc_
 
 #define ARCCLIENTC_VERSION "0.1"
-#include "submit.h"
 #include "common_utils.h"
 /* Things below are exported */
 
index 9c0e3e7..5a26ed9 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef logger_
 #define logger_
 
-#include "arc_libs.h"
+#include <arc/Logger.h>
 //static Arc::Logger* logger; 
 static Arc::Logger logger(Arc::Logger::getRootLogger(), "arcclientc");
 #endif
diff --git a/src/submit.cpp b/src/submit.cpp
deleted file mode 100644 (file)
index bd25b14..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- *  submit.cpp
- *  arcclientc
- *
- *  Created by Tamas Jung on 4/7/10.
- *  Copyright 2010 Interface Kft. All rights reserved.
- *
- */
-
-#include "submit.h"
-#include "logger.h"
-#include "config.h" //TBD: Kell ez?
-// -*- indent-tabs-mode: nil -*-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <fstream>
-#include <iostream>
-#include <list>
-#include <string>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "arc_libs.h"
-
-
-submit_result_t* submit(int argc, char **argv) {
-       
-       
-       
-       
-       
-       
-       
-       
-       submit_result_t* result = (submit_result_t*)malloc(sizeof(submit_result_t));
-       if (!result) {
-               return NULL;//TBD: throw sth?
-       }
-       result->message = NULL;
-       result->job_id = NULL;
-       
-       
-
-       //TODO: what necessary here?
-       Arc::OptionParser options(istring("[filename ...]"),
-                                                         istring("The arcsub command is used for "
-                                                                         "submitting jobs to grid enabled "
-                                                                         "computing\nresources."),
-                                                         istring("Argument to -i has the format "
-                                                                         "Flavour:URL e.g.\n"
-                                                                         "ARC0:ldap://grid.tsl.uu.se:2135/"
-                                                                         "mds-vo-name=sweden,O=grid\n"
-                                                                         "CREAM:ldap://cream.grid.upjs.sk:2170/"
-                                                                         "o=grid\n"
-                                                                         "\n"
-                                                                         "Argument to -c has the format "
-                                                                         "Flavour:URL e.g.\n"
-                                                                         "ARC0:ldap://grid.tsl.uu.se:2135/"
-                                                                         "nordugrid-cluster-name=grid.tsl.uu.se,"
-                                                                         "Mds-Vo-name=local,o=grid"));
-       
-       std::list<std::string> clusters;
-       options.AddOption('c', "cluster",
-                                         istring("explicity select or reject a specific cluster"),
-                                         istring("[-]name"),
-                                         clusters);
-       
-       std::list<std::string> indexurls;
-       options.AddOption('i', "index",
-                                         istring("explicity select or reject an index server"),
-                                         istring("[-]name"),
-                                         indexurls);
-       
-       std::string jobdescriptionstring;
-       options.AddOption('e', "jobdescrstring",
-                                         istring("jobdescription string describing the job to "
-                                                         "be submitted"),
-                                         istring("string"),
-                                         jobdescriptionstring);
-       
-
-       
-       
-       //jt: dryrun was commented out in the original file, I try to use it TODO:
-     bool dryrun = false;
-     options.AddOption('D', "dryrun", istring("add dryrun option"),
-        dryrun);
-        
-       int timeout = -1;
-       options.AddOption('t', "timeout", istring("timeout in seconds (default 20)"),
-                                         istring("seconds"), timeout);
-       
-       std::string conffile;
-       options.AddOption('z', "conffile",
-                                         istring("configuration file (default ~/.arc/client.conf)"),
-                                         istring("filename"), conffile);
-               
-       std::string broker;
-       options.AddOption('b', "broker",
-                                         istring("select broker method (Random (default), FastestQueue, or custom)"),
-                                         istring("broker"), broker);
-       
-       
-       std::list<std::string> params = options.Parse(argc, argv);
-       
-       
-       Arc::UserConfig usercfg(conffile);
-       if (!usercfg) {
-               result->message = new_str("Failed configuration initialization");
-               return result;  
-       }
-       
-       if (timeout > 0)
-               usercfg.Timeout(timeout);
-       
-       if (!broker.empty())
-               usercfg.Broker(broker);
-               
-       if (!clusters.empty() || !indexurls.empty())
-               usercfg.ClearSelectedServices();
-       
-       if (!clusters.empty())
-               usercfg.AddServices(clusters, Arc::COMPUTING);
-       
-       if (!indexurls.empty())
-               usercfg.AddServices(indexurls, Arc::INDEX);
-       
-       if (jobdescriptionstring.empty()) {
-               result->message = new_str("No job description input specified");
-               return result;
-       }
-       
-       
-
-               
-       Arc::JobDescription jobdesc;
-       
-       jobdesc.Parse(jobdescriptionstring);
-       
-       if (!jobdesc){
-               std::ostringstream sstr;
-               sstr << "Invalid JobDescription:";
-               sstr << jobdescriptionstring;
-               result->message = ostringstream2cstring(sstr);
-               return result;
-       }
-       
-       Arc::TargetGenerator targen(usercfg);
-       targen.GetTargets(0, 1);
-       
-       if (targen.FoundTargets().empty()) {
-               
-               result->message = new_str("Job submission aborted because no clusters returned any information");
-               return result;
-       }
-       
-       
-       
-       Arc::BrokerLoader loader;
-       Arc::Broker *ChosenBroker = loader.load(usercfg.Broker().first, usercfg);
-       if (!ChosenBroker) {
-               std::ostringstream sstream;
-               sstream << "Unable to load broker " << usercfg.Broker().first;
-               result->message = ostringstream2cstring(sstream);
-               return result;
-       }
-       logger.msg(Arc::INFO, "Broker %s loaded", usercfg.Broker().first);
-       
-               
-       ChosenBroker->PreFilterTargets(targen.ModifyFoundTargets(), jobdesc);
-       
-       while (true) {
-               const Arc::ExecutionTarget* target = ChosenBroker->GetBestTarget();
-               
-               if (!target) {
-                       result->message = new_str("Job submission failed, no more possible targets");
-                       break;
-               }
-               
-               Arc::Submitter *submitter = target->GetSubmitter(usercfg);
-                               
-               if (dryrun) {
-                       result->message = new_str("Dry run, job submission is skipped");
-                       break;
-               }
-               //submit the job
-               Arc::URL jobid = submitter->Submit(jobdesc, *target);
-               if (!jobid) {
-                       logger.msg(Arc::INFO, "Submission to %s failed, trying next target", target->url.str());
-                       continue;
-               }
-               
-               ChosenBroker->RegisterJobsubmission();
-               result->job_id = new_str(jobid.str().c_str());
-               logger.msg(Arc::DEBUG, "Job submitted with jobid: %s", jobid.str());
-               
-               break;
-       } //end loop over all possible targets
-       
-       return result;
-}
-
-
diff --git a/src/submit.h b/src/submit.h
deleted file mode 100644 (file)
index a94efe5..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *  submit.h
- *  arcclientc
- *
- *  Created by Tamas Jung on 4/7/10.
- *  Copyright 2010 Interface Kft. All rights reserved.
- *
- */
-
-#ifndef submit_
-#define submit_
-
-#include "common_utils.h"
-
-typedef struct{
-       char* message;//might be NULL
-       char* job_id;//might be NULL
-} submit_result_t;
-
-PUBLIC_C submit_result_t* submit(int argc, char **argv);
-
-#endif
-