The ARC Software Development Kit (SDK) is a set of tools that allow manipulation of jobs and data in a Grid environment. The SDK is divided into a set of modules which take care of different aspects of Grid interaction.
- Version
- The version of the SDK that this documentation refers to can be found from ARC_VERSION. The ARC release corresponding to the SDK version can be found using the "SVN tag" column in the table at http://www.nordugrid.org/arc/releases/
Quick Start
The following code is a minimal example showing how to submit a job to a Grid resource using the ARC SDK:
#include <arc/Logger.h>
#include <arc/UserConfig.h>
#include <arc/compute/Endpoint.h>
#include <arc/compute/Job.h>
#include <arc/compute/JobDescription.h>
#include <arc/compute/Submitter.h>
#include <arc/compute/JobInformationStorage.h>
int main() {
std::string jobdesc("&(executable=/bin/hostname)(stdout=stdout)");
std::list<Arc::JobDescription> jobdescs;
logger.msg(
Arc::ERROR,
"Invalid job description");
return 1;
}
Arc::Endpoint index(
"ldap://index1.nordugrid.org:2135/Mds-Vo-name=NorduGrid,o=grid",
Arc::Endpoint::REGISTRY,
"org.nordugrid.ldapegiis");
std::list<Arc::Endpoint> services(1, index);
std::list<Arc::Job> jobs;
if (submitter.BrokeredSubmit(services, jobdescs, jobs) != Arc::SubmissionStatus::NONE) {
return 1;
}
if (!jobList.Write(jobs)) {
}
std::cout << "Job submitted with job id " << jobs.front().JobID << std::endl;
return 0;
}
This code can be compiled with
g++ -o submit -I/usr/include/libxml2 `pkg-config --cflags glibmm-2.4` -l arccompute submit.cpp
And this example shows how to copy a file to or from the Grid:
#include <arc/Logger.h>
#include <arc/URL.h>
#include <arc/UserConfig.h>
#include <arc/data/DataHandle.h>
#include <arc/data/DataMover.h>
int main(int argc, char** argv) {
if (argc != 3) {
logger.msg(
Arc::ERROR,
"Usage: copy source destination");
return 1;
}
logger.msg(
Arc::ERROR,
"Copy failed: %s", std::string(result));
return 1;
}
return 0;
}
This example can be compiled with
g++ -o copy -I/usr/include/libxml2 `pkg-config --cflags glibmm-2.4` -l arcdata copy.cpp