My Project
Loading...
Searching...
No Matches
dxjob.h
Go to the documentation of this file.
1// Copyright (C) 2013-2016 DNAnexus, Inc.
2//
3// This file is part of dx-toolkit (DNAnexus platform client libraries).
4//
5// Licensed under the Apache License, Version 2.0 (the "License"); you may
6// not use this file except in compliance with the License. You may obtain a
7// copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14// License for the specific language governing permissions and limitations
15// under the License.
16
22#ifndef DXCPP_BINDINGS_DXJOB_H
23#define DXCPP_BINDINGS_DXJOB_H
24
25#include <string>
26#include <limits>
27#include "dxjson/dxjson.h"
28
29namespace dx {
31
40
41 class DXJob {
42 private:
43 std::string dxid_;
44 public:
45 DXJob() { }
46
52 DXJob(const std::string &dxid) : dxid_(dxid) { }
53
61 dx::JSON describe() const;
62
68 void setID(const std::string &dxid) { dxid_ = dxid; }
69
77 std::string getState() const { return describe()["state"].get<std::string>(); }
78
85 std::string getID() const { return dxid_; }
86
104 void create(const dx::JSON &fn_input,
105 const std::string &fn_name,
106 const std::string &job_name="",
107 const std::vector<std::string> &depends_on=std::vector<std::string>(),
108 const dx::JSON &instance_type=dx::JSON(dx::JSON_NULL)
109 );
110
116 void terminate() const;
117
130 void waitOnDone(const int timeout=std::numeric_limits<int>::max()) const;
131
142 dx::JSON getOutputRef(const std::string &field);
143
163 static DXJob newDXJob(const dx::JSON &fn_input,
164 const std::string &fn_name,
165 const std::string &job_name="",
166 const std::vector<std::string> &depends_on=std::vector<std::string>(),
167 const dx::JSON &instance_type=dx::JSON(dx::JSON_NULL)
168 );
169 };
170}
171
172#include "../bindings.h"
173
174#endif
The instantiation of an applet or app.
Definition dxjob.h:41
dx::JSON getOutputRef(const std::string &field)
Definition dxjob.cc:90
dx::JSON describe() const
Definition dxjob.cc:23
std::string getState() const
Definition dxjob.h:77
std::string getID() const
Definition dxjob.h:85
DXJob(const std::string &dxid)
Definition dxjob.h:52
void terminate() const
Definition dxjob.cc:70
static DXJob newDXJob(const dx::JSON &fn_input, const std::string &fn_name, const std::string &job_name="", const std::vector< std::string > &depends_on=std::vector< std::string >(), const dx::JSON &instance_type=dx::JSON(dx::JSON_NULL))
Definition dxjob.cc:97
void setID(const std::string &dxid)
Definition dxjob.h:68
void create(const dx::JSON &fn_input, const std::string &fn_name, const std::string &job_name="", const std::vector< std::string > &depends_on=std::vector< std::string >(), const dx::JSON &instance_type=dx::JSON(dx::JSON_NULL))
Definition dxjob.cc:30
void waitOnDone(const int timeout=std::numeric_limits< int >::max()) const
Definition dxjob.cc:76
An executable object that can be published for others to discover.
Definition api.cc:7