Repository: airavata Updated Branches: refs/heads/orchestratorTaskBreakdown cb21871fe -> af295229a
Adding Task model changes Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/af295229 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/af295229 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/af295229 Branch: refs/heads/orchestratorTaskBreakdown Commit: af295229a8a27fa3718b84ed552dcc702a62d4c2 Parents: cb21871 Author: Shameera Rathnayaka <[email protected]> Authored: Mon Oct 12 16:55:32 2015 -0400 Committer: Shameera Rathnayaka <[email protected]> Committed: Mon Oct 12 16:55:32 2015 -0400 ---------------------------------------------------------------------- .../resources/lib/airavata/task_model_types.cpp | 175 ++++++-- .../resources/lib/airavata/task_model_types.h | 59 ++- .../resources/lib/Airavata/Model/Task/Types.php | 135 +++++- .../lib/apache/airavata/model/task/ttypes.py | 127 +++++- .../airavata/model/task/DataStageType.java | 69 +++ .../model/task/DataStagingTaskModel.java | 146 ++++++- .../model/task/JobSubmissionTaskModel.java | 418 +++++++++++++++++++ .../airavata/common/utils/ThriftUtils.java | 5 +- .../airavata-api/task_model.thrift | 18 +- 9 files changed, 1072 insertions(+), 80 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/af295229/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/task_model_types.cpp ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/task_model_types.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/task_model_types.cpp index e0b1a79..f152671 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/task_model_types.cpp +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/task_model_types.cpp @@ -46,6 +46,16 @@ const char* _kTaskTypesNames[] = { }; const std::map<int, const char*> _TaskTypes_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(5, _kTaskTypesValues, _kTaskTypesNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); +int _kDataStageTypeValues[] = { + DataStageType::INPUT, + DataStageType::OUPUT +}; +const char* _kDataStageTypeNames[] = { + "INPUT", + "OUPUT" +}; +const std::map<int, const char*> _DataStageType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(2, _kDataStageTypeValues, _kDataStageTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); + TaskModel::~TaskModel() throw() { } @@ -335,6 +345,10 @@ void DataStagingTaskModel::__set_destination(const std::string& val) { this->destination = val; } +void DataStagingTaskModel::__set_type(const DataStageType::type val) { + this->type = val; +} + void DataStagingTaskModel::__set_transferStartTime(const int64_t val) { this->transferStartTime = val; __isset.transferStartTime = true; @@ -350,8 +364,8 @@ void DataStagingTaskModel::__set_transferRate(const std::string& val) { __isset.transferRate = true; } -const char* DataStagingTaskModel::ascii_fingerprint = "3224DD8D1EC3134AB6350703A4B92D60"; -const uint8_t DataStagingTaskModel::binary_fingerprint[16] = {0x32,0x24,0xDD,0x8D,0x1E,0xC3,0x13,0x4A,0xB6,0x35,0x07,0x03,0xA4,0xB9,0x2D,0x60}; +const char* DataStagingTaskModel::ascii_fingerprint = "68560D7ABF8515154C93E0A04DD9CF55"; +const uint8_t DataStagingTaskModel::binary_fingerprint[16] = {0x68,0x56,0x0D,0x7A,0xBF,0x85,0x15,0x15,0x4C,0x93,0xE0,0xA0,0x4D,0xD9,0xCF,0x55}; uint32_t DataStagingTaskModel::read(::apache::thrift::protocol::TProtocol* iprot) { @@ -366,6 +380,7 @@ uint32_t DataStagingTaskModel::read(::apache::thrift::protocol::TProtocol* iprot bool isset_source = false; bool isset_destination = false; + bool isset_type = false; while (true) { @@ -392,6 +407,16 @@ uint32_t DataStagingTaskModel::read(::apache::thrift::protocol::TProtocol* iprot } break; case 3: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast3; + xfer += iprot->readI32(ecast3); + this->type = (DataStageType::type)ecast3; + isset_type = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: if (ftype == ::apache::thrift::protocol::T_I64) { xfer += iprot->readI64(this->transferStartTime); this->__isset.transferStartTime = true; @@ -399,7 +424,7 @@ uint32_t DataStagingTaskModel::read(::apache::thrift::protocol::TProtocol* iprot xfer += iprot->skip(ftype); } break; - case 4: + case 5: if (ftype == ::apache::thrift::protocol::T_I64) { xfer += iprot->readI64(this->transferEndTime); this->__isset.transferEndTime = true; @@ -407,7 +432,7 @@ uint32_t DataStagingTaskModel::read(::apache::thrift::protocol::TProtocol* iprot xfer += iprot->skip(ftype); } break; - case 5: + case 6: if (ftype == ::apache::thrift::protocol::T_STRING) { xfer += iprot->readString(this->transferRate); this->__isset.transferRate = true; @@ -428,6 +453,8 @@ uint32_t DataStagingTaskModel::read(::apache::thrift::protocol::TProtocol* iprot throw TProtocolException(TProtocolException::INVALID_DATA); if (!isset_destination) throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_type) + throw TProtocolException(TProtocolException::INVALID_DATA); return xfer; } @@ -444,18 +471,22 @@ uint32_t DataStagingTaskModel::write(::apache::thrift::protocol::TProtocol* opro xfer += oprot->writeString(this->destination); xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("type", ::apache::thrift::protocol::T_I32, 3); + xfer += oprot->writeI32((int32_t)this->type); + xfer += oprot->writeFieldEnd(); + if (this->__isset.transferStartTime) { - xfer += oprot->writeFieldBegin("transferStartTime", ::apache::thrift::protocol::T_I64, 3); + xfer += oprot->writeFieldBegin("transferStartTime", ::apache::thrift::protocol::T_I64, 4); xfer += oprot->writeI64(this->transferStartTime); xfer += oprot->writeFieldEnd(); } if (this->__isset.transferEndTime) { - xfer += oprot->writeFieldBegin("transferEndTime", ::apache::thrift::protocol::T_I64, 4); + xfer += oprot->writeFieldBegin("transferEndTime", ::apache::thrift::protocol::T_I64, 5); xfer += oprot->writeI64(this->transferEndTime); xfer += oprot->writeFieldEnd(); } if (this->__isset.transferRate) { - xfer += oprot->writeFieldBegin("transferRate", ::apache::thrift::protocol::T_STRING, 5); + xfer += oprot->writeFieldBegin("transferRate", ::apache::thrift::protocol::T_STRING, 6); xfer += oprot->writeString(this->transferRate); xfer += oprot->writeFieldEnd(); } @@ -469,27 +500,30 @@ void swap(DataStagingTaskModel &a, DataStagingTaskModel &b) { using ::std::swap; swap(a.source, b.source); swap(a.destination, b.destination); + swap(a.type, b.type); swap(a.transferStartTime, b.transferStartTime); swap(a.transferEndTime, b.transferEndTime); swap(a.transferRate, b.transferRate); swap(a.__isset, b.__isset); } -DataStagingTaskModel::DataStagingTaskModel(const DataStagingTaskModel& other3) { - source = other3.source; - destination = other3.destination; - transferStartTime = other3.transferStartTime; - transferEndTime = other3.transferEndTime; - transferRate = other3.transferRate; - __isset = other3.__isset; -} -DataStagingTaskModel& DataStagingTaskModel::operator=(const DataStagingTaskModel& other4) { +DataStagingTaskModel::DataStagingTaskModel(const DataStagingTaskModel& other4) { source = other4.source; destination = other4.destination; + type = other4.type; transferStartTime = other4.transferStartTime; transferEndTime = other4.transferEndTime; transferRate = other4.transferRate; __isset = other4.__isset; +} +DataStagingTaskModel& DataStagingTaskModel::operator=(const DataStagingTaskModel& other5) { + source = other5.source; + destination = other5.destination; + type = other5.type; + transferStartTime = other5.transferStartTime; + transferEndTime = other5.transferEndTime; + transferRate = other5.transferRate; + __isset = other5.__isset; return *this; } std::ostream& operator<<(std::ostream& out, const DataStagingTaskModel& obj) { @@ -497,6 +531,7 @@ std::ostream& operator<<(std::ostream& out, const DataStagingTaskModel& obj) { out << "DataStagingTaskModel("; out << "source=" << to_string(obj.source); out << ", " << "destination=" << to_string(obj.destination); + out << ", " << "type=" << to_string(obj.type); out << ", " << "transferStartTime="; (obj.__isset.transferStartTime ? (out << to_string(obj.transferStartTime)) : (out << "<null>")); out << ", " << "transferEndTime="; (obj.__isset.transferEndTime ? (out << to_string(obj.transferEndTime)) : (out << "<null>")); out << ", " << "transferRate="; (obj.__isset.transferRate ? (out << to_string(obj.transferRate)) : (out << "<null>")); @@ -552,9 +587,9 @@ uint32_t EnvironmentSetupTaskModel::read(::apache::thrift::protocol::TProtocol* break; case 2: if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast5; - xfer += iprot->readI32(ecast5); - this->protocol = ( ::apache::airavata::model::appcatalog::computeresource::SecurityProtocol::type)ecast5; + int32_t ecast6; + xfer += iprot->readI32(ecast6); + this->protocol = ( ::apache::airavata::model::appcatalog::computeresource::SecurityProtocol::type)ecast6; isset_protocol = true; } else { xfer += iprot->skip(ftype); @@ -601,13 +636,13 @@ void swap(EnvironmentSetupTaskModel &a, EnvironmentSetupTaskModel &b) { swap(a.protocol, b.protocol); } -EnvironmentSetupTaskModel::EnvironmentSetupTaskModel(const EnvironmentSetupTaskModel& other6) { - location = other6.location; - protocol = other6.protocol; -} -EnvironmentSetupTaskModel& EnvironmentSetupTaskModel::operator=(const EnvironmentSetupTaskModel& other7) { +EnvironmentSetupTaskModel::EnvironmentSetupTaskModel(const EnvironmentSetupTaskModel& other7) { location = other7.location; protocol = other7.protocol; +} +EnvironmentSetupTaskModel& EnvironmentSetupTaskModel::operator=(const EnvironmentSetupTaskModel& other8) { + location = other8.location; + protocol = other8.protocol; return *this; } std::ostream& operator<<(std::ostream& out, const EnvironmentSetupTaskModel& obj) { @@ -619,4 +654,96 @@ std::ostream& operator<<(std::ostream& out, const EnvironmentSetupTaskModel& obj return out; } + +JobSubmissionTaskModel::~JobSubmissionTaskModel() throw() { +} + + +void JobSubmissionTaskModel::__set_monitorMode(const ::apache::airavata::model::appcatalog::computeresource::MonitorMode::type val) { + this->monitorMode = val; +} + +const char* JobSubmissionTaskModel::ascii_fingerprint = "8BBB3D0C3B370CB38F2D1340BB79F0AA"; +const uint8_t JobSubmissionTaskModel::binary_fingerprint[16] = {0x8B,0xBB,0x3D,0x0C,0x3B,0x37,0x0C,0xB3,0x8F,0x2D,0x13,0x40,0xBB,0x79,0xF0,0xAA}; + +uint32_t JobSubmissionTaskModel::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + bool isset_monitorMode = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast9; + xfer += iprot->readI32(ecast9); + this->monitorMode = ( ::apache::airavata::model::appcatalog::computeresource::MonitorMode::type)ecast9; + isset_monitorMode = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_monitorMode) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t JobSubmissionTaskModel::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + oprot->incrementRecursionDepth(); + xfer += oprot->writeStructBegin("JobSubmissionTaskModel"); + + xfer += oprot->writeFieldBegin("monitorMode", ::apache::thrift::protocol::T_I32, 1); + xfer += oprot->writeI32((int32_t)this->monitorMode); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + oprot->decrementRecursionDepth(); + return xfer; +} + +void swap(JobSubmissionTaskModel &a, JobSubmissionTaskModel &b) { + using ::std::swap; + swap(a.monitorMode, b.monitorMode); +} + +JobSubmissionTaskModel::JobSubmissionTaskModel(const JobSubmissionTaskModel& other10) { + monitorMode = other10.monitorMode; +} +JobSubmissionTaskModel& JobSubmissionTaskModel::operator=(const JobSubmissionTaskModel& other11) { + monitorMode = other11.monitorMode; + return *this; +} +std::ostream& operator<<(std::ostream& out, const JobSubmissionTaskModel& obj) { + using apache::thrift::to_string; + out << "JobSubmissionTaskModel("; + out << "monitorMode=" << to_string(obj.monitorMode); + out << ")"; + return out; +} + }}}} // namespace http://git-wip-us.apache.org/repos/asf/airavata/blob/af295229/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/task_model_types.h ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/task_model_types.h b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/task_model_types.h index 321a807..aa353e1 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/task_model_types.h +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/task_model_types.h @@ -51,12 +51,23 @@ struct TaskTypes { extern const std::map<int, const char*> _TaskTypes_VALUES_TO_NAMES; +struct DataStageType { + enum type { + INPUT = 0, + OUPUT = 1 + }; +}; + +extern const std::map<int, const char*> _DataStageType_VALUES_TO_NAMES; + class TaskModel; class DataStagingTaskModel; class EnvironmentSetupTaskModel; +class JobSubmissionTaskModel; + typedef struct _TaskModel__isset { _TaskModel__isset() : taskDetail(false), subTaskModel(false), taskError(false) {} bool taskDetail :1; @@ -158,17 +169,18 @@ typedef struct _DataStagingTaskModel__isset { class DataStagingTaskModel { public: - static const char* ascii_fingerprint; // = "3224DD8D1EC3134AB6350703A4B92D60"; - static const uint8_t binary_fingerprint[16]; // = {0x32,0x24,0xDD,0x8D,0x1E,0xC3,0x13,0x4A,0xB6,0x35,0x07,0x03,0xA4,0xB9,0x2D,0x60}; + static const char* ascii_fingerprint; // = "68560D7ABF8515154C93E0A04DD9CF55"; + static const uint8_t binary_fingerprint[16]; // = {0x68,0x56,0x0D,0x7A,0xBF,0x85,0x15,0x15,0x4C,0x93,0xE0,0xA0,0x4D,0xD9,0xCF,0x55}; DataStagingTaskModel(const DataStagingTaskModel&); DataStagingTaskModel& operator=(const DataStagingTaskModel&); - DataStagingTaskModel() : source(), destination(), transferStartTime(0), transferEndTime(0), transferRate() { + DataStagingTaskModel() : source(), destination(), type((DataStageType::type)0), transferStartTime(0), transferEndTime(0), transferRate() { } virtual ~DataStagingTaskModel() throw(); std::string source; std::string destination; + DataStageType::type type; int64_t transferStartTime; int64_t transferEndTime; std::string transferRate; @@ -179,6 +191,8 @@ class DataStagingTaskModel { void __set_destination(const std::string& val); + void __set_type(const DataStageType::type val); + void __set_transferStartTime(const int64_t val); void __set_transferEndTime(const int64_t val); @@ -191,6 +205,8 @@ class DataStagingTaskModel { return false; if (!(destination == rhs.destination)) return false; + if (!(type == rhs.type)) + return false; if (__isset.transferStartTime != rhs.__isset.transferStartTime) return false; else if (__isset.transferStartTime && !(transferStartTime == rhs.transferStartTime)) @@ -261,6 +277,43 @@ class EnvironmentSetupTaskModel { void swap(EnvironmentSetupTaskModel &a, EnvironmentSetupTaskModel &b); + +class JobSubmissionTaskModel { + public: + + static const char* ascii_fingerprint; // = "8BBB3D0C3B370CB38F2D1340BB79F0AA"; + static const uint8_t binary_fingerprint[16]; // = {0x8B,0xBB,0x3D,0x0C,0x3B,0x37,0x0C,0xB3,0x8F,0x2D,0x13,0x40,0xBB,0x79,0xF0,0xAA}; + + JobSubmissionTaskModel(const JobSubmissionTaskModel&); + JobSubmissionTaskModel& operator=(const JobSubmissionTaskModel&); + JobSubmissionTaskModel() : monitorMode(( ::apache::airavata::model::appcatalog::computeresource::MonitorMode::type)0) { + } + + virtual ~JobSubmissionTaskModel() throw(); + ::apache::airavata::model::appcatalog::computeresource::MonitorMode::type monitorMode; + + void __set_monitorMode(const ::apache::airavata::model::appcatalog::computeresource::MonitorMode::type val); + + bool operator == (const JobSubmissionTaskModel & rhs) const + { + if (!(monitorMode == rhs.monitorMode)) + return false; + return true; + } + bool operator != (const JobSubmissionTaskModel &rhs) const { + return !(*this == rhs); + } + + bool operator < (const JobSubmissionTaskModel & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + + friend std::ostream& operator<<(std::ostream& out, const JobSubmissionTaskModel& obj); +}; + +void swap(JobSubmissionTaskModel &a, JobSubmissionTaskModel &b); + }}}} // namespace #endif http://git-wip-us.apache.org/repos/asf/airavata/blob/af295229/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Task/Types.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Task/Types.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Task/Types.php index f272524..704b406 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Task/Types.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Task/Types.php @@ -37,6 +37,22 @@ final class TaskTypes { } /** + * DataStagingTaskModel: A structure holding the data staging task details. + * + * Source and Destination locations includes standard representation of protocol, host, port and path + * A friendly description of the task, usally used to communicate information to users. + * + */ +final class DataStageType { + const INPUT = 0; + const OUPUT = 1; + static public $__names = array( + 0 => 'INPUT', + 1 => 'OUPUT', + ); +} + +/** * TaskModel: A structure holding the generic task details. * * taskDetail: @@ -314,13 +330,6 @@ class TaskModel { } -/** - * DataStagingTaskModel: A structure holding the data staging task details. - * - * Source and Destination locations includes standard representation of protocol, host, port and path - * A friendly description of the task, usally used to communicate information to users. - * - */ class DataStagingTaskModel { static $_TSPEC; @@ -335,6 +344,10 @@ class DataStagingTaskModel { /** * @var int */ + public $type = null; + /** + * @var int + */ public $transferStartTime = null; /** * @var int @@ -357,14 +370,18 @@ class DataStagingTaskModel { 'type' => TType::STRING, ), 3 => array( + 'var' => 'type', + 'type' => TType::I32, + ), + 4 => array( 'var' => 'transferStartTime', 'type' => TType::I64, ), - 4 => array( + 5 => array( 'var' => 'transferEndTime', 'type' => TType::I64, ), - 5 => array( + 6 => array( 'var' => 'transferRate', 'type' => TType::STRING, ), @@ -377,6 +394,9 @@ class DataStagingTaskModel { if (isset($vals['destination'])) { $this->destination = $vals['destination']; } + if (isset($vals['type'])) { + $this->type = $vals['type']; + } if (isset($vals['transferStartTime'])) { $this->transferStartTime = $vals['transferStartTime']; } @@ -423,20 +443,27 @@ class DataStagingTaskModel { } break; case 3: + if ($ftype == TType::I32) { + $xfer += $input->readI32($this->type); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: if ($ftype == TType::I64) { $xfer += $input->readI64($this->transferStartTime); } else { $xfer += $input->skip($ftype); } break; - case 4: + case 5: if ($ftype == TType::I64) { $xfer += $input->readI64($this->transferEndTime); } else { $xfer += $input->skip($ftype); } break; - case 5: + case 6: if ($ftype == TType::STRING) { $xfer += $input->readString($this->transferRate); } else { @@ -466,18 +493,23 @@ class DataStagingTaskModel { $xfer += $output->writeString($this->destination); $xfer += $output->writeFieldEnd(); } + if ($this->type !== null) { + $xfer += $output->writeFieldBegin('type', TType::I32, 3); + $xfer += $output->writeI32($this->type); + $xfer += $output->writeFieldEnd(); + } if ($this->transferStartTime !== null) { - $xfer += $output->writeFieldBegin('transferStartTime', TType::I64, 3); + $xfer += $output->writeFieldBegin('transferStartTime', TType::I64, 4); $xfer += $output->writeI64($this->transferStartTime); $xfer += $output->writeFieldEnd(); } if ($this->transferEndTime !== null) { - $xfer += $output->writeFieldBegin('transferEndTime', TType::I64, 4); + $xfer += $output->writeFieldBegin('transferEndTime', TType::I64, 5); $xfer += $output->writeI64($this->transferEndTime); $xfer += $output->writeFieldEnd(); } if ($this->transferRate !== null) { - $xfer += $output->writeFieldBegin('transferRate', TType::STRING, 5); + $xfer += $output->writeFieldBegin('transferRate', TType::STRING, 6); $xfer += $output->writeString($this->transferRate); $xfer += $output->writeFieldEnd(); } @@ -590,4 +622,79 @@ class EnvironmentSetupTaskModel { } +class JobSubmissionTaskModel { + static $_TSPEC; + + /** + * @var int + */ + public $monitorMode = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'monitorMode', + 'type' => TType::I32, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['monitorMode'])) { + $this->monitorMode = $vals['monitorMode']; + } + } + } + + public function getName() { + return 'JobSubmissionTaskModel'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::I32) { + $xfer += $input->readI32($this->monitorMode); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('JobSubmissionTaskModel'); + if ($this->monitorMode !== null) { + $xfer += $output->writeFieldBegin('monitorMode', TType::I32, 1); + $xfer += $output->writeI32($this->monitorMode); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/af295229/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/task/ttypes.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/task/ttypes.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/task/ttypes.py index 0433c88..8833e7e 100644 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/task/ttypes.py +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/task/ttypes.py @@ -47,6 +47,27 @@ class TaskTypes: "MONITORING": 4, } +class DataStageType: + """ + DataStagingTaskModel: A structure holding the data staging task details. + + Source and Destination locations includes standard representation of protocol, host, port and path + A friendly description of the task, usally used to communicate information to users. + + """ + INPUT = 0 + OUPUT = 1 + + _VALUES_TO_NAMES = { + 0: "INPUT", + 1: "OUPUT", + } + + _NAMES_TO_VALUES = { + "INPUT": 0, + "OUPUT": 1, + } + class TaskModel: """ @@ -241,15 +262,10 @@ class TaskModel: class DataStagingTaskModel: """ - DataStagingTaskModel: A structure holding the data staging task details. - - Source and Destination locations includes standard representation of protocol, host, port and path - A friendly description of the task, usally used to communicate information to users. - - Attributes: - source - destination + - type - transferStartTime - transferEndTime - transferRate @@ -259,14 +275,16 @@ class DataStagingTaskModel: None, # 0 (1, TType.STRING, 'source', None, None, ), # 1 (2, TType.STRING, 'destination', None, None, ), # 2 - (3, TType.I64, 'transferStartTime', None, None, ), # 3 - (4, TType.I64, 'transferEndTime', None, None, ), # 4 - (5, TType.STRING, 'transferRate', None, None, ), # 5 + (3, TType.I32, 'type', None, None, ), # 3 + (4, TType.I64, 'transferStartTime', None, None, ), # 4 + (5, TType.I64, 'transferEndTime', None, None, ), # 5 + (6, TType.STRING, 'transferRate', None, None, ), # 6 ) - def __init__(self, source=None, destination=None, transferStartTime=None, transferEndTime=None, transferRate=None,): + def __init__(self, source=None, destination=None, type=None, transferStartTime=None, transferEndTime=None, transferRate=None,): self.source = source self.destination = destination + self.type = type self.transferStartTime = transferStartTime self.transferEndTime = transferEndTime self.transferRate = transferRate @@ -291,16 +309,21 @@ class DataStagingTaskModel: else: iprot.skip(ftype) elif fid == 3: + if ftype == TType.I32: + self.type = iprot.readI32(); + else: + iprot.skip(ftype) + elif fid == 4: if ftype == TType.I64: self.transferStartTime = iprot.readI64(); else: iprot.skip(ftype) - elif fid == 4: + elif fid == 5: if ftype == TType.I64: self.transferEndTime = iprot.readI64(); else: iprot.skip(ftype) - elif fid == 5: + elif fid == 6: if ftype == TType.STRING: self.transferRate = iprot.readString(); else: @@ -323,16 +346,20 @@ class DataStagingTaskModel: oprot.writeFieldBegin('destination', TType.STRING, 2) oprot.writeString(self.destination) oprot.writeFieldEnd() + if self.type is not None: + oprot.writeFieldBegin('type', TType.I32, 3) + oprot.writeI32(self.type) + oprot.writeFieldEnd() if self.transferStartTime is not None: - oprot.writeFieldBegin('transferStartTime', TType.I64, 3) + oprot.writeFieldBegin('transferStartTime', TType.I64, 4) oprot.writeI64(self.transferStartTime) oprot.writeFieldEnd() if self.transferEndTime is not None: - oprot.writeFieldBegin('transferEndTime', TType.I64, 4) + oprot.writeFieldBegin('transferEndTime', TType.I64, 5) oprot.writeI64(self.transferEndTime) oprot.writeFieldEnd() if self.transferRate is not None: - oprot.writeFieldBegin('transferRate', TType.STRING, 5) + oprot.writeFieldBegin('transferRate', TType.STRING, 6) oprot.writeString(self.transferRate) oprot.writeFieldEnd() oprot.writeFieldStop() @@ -343,6 +370,8 @@ class DataStagingTaskModel: raise TProtocol.TProtocolException(message='Required field source is unset!') if self.destination is None: raise TProtocol.TProtocolException(message='Required field destination is unset!') + if self.type is None: + raise TProtocol.TProtocolException(message='Required field type is unset!') return @@ -350,6 +379,7 @@ class DataStagingTaskModel: value = 17 value = (value * 31) ^ hash(self.source) value = (value * 31) ^ hash(self.destination) + value = (value * 31) ^ hash(self.type) value = (value * 31) ^ hash(self.transferStartTime) value = (value * 31) ^ hash(self.transferEndTime) value = (value * 31) ^ hash(self.transferRate) @@ -450,3 +480,70 @@ class EnvironmentSetupTaskModel: def __ne__(self, other): return not (self == other) + +class JobSubmissionTaskModel: + """ + Attributes: + - monitorMode + """ + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'monitorMode', None, None, ), # 1 + ) + + def __init__(self, monitorMode=None,): + self.monitorMode = monitorMode + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.monitorMode = iprot.readI32(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('JobSubmissionTaskModel') + if self.monitorMode is not None: + oprot.writeFieldBegin('monitorMode', TType.I32, 1) + oprot.writeI32(self.monitorMode) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.monitorMode is None: + raise TProtocol.TProtocolException(message='Required field monitorMode is unset!') + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.monitorMode) + return value + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) http://git-wip-us.apache.org/repos/asf/airavata/blob/af295229/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStageType.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStageType.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStageType.java new file mode 100644 index 0000000..48a852d --- /dev/null +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStageType.java @@ -0,0 +1,69 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.task; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +/** + * DataStagingTaskModel: A structure holding the data staging task details. + * + * Source and Destination locations includes standard representation of protocol, host, port and path + * A friendly description of the task, usally used to communicate information to users. + * + */ +public enum DataStageType implements org.apache.thrift.TEnum { + INPUT(0), + OUPUT(1); + + private final int value; + + private DataStageType(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static DataStageType findByValue(int value) { + switch (value) { + case 0: + return INPUT; + case 1: + return OUPUT; + default: + return null; + } + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/af295229/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStagingTaskModel.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStagingTaskModel.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStagingTaskModel.java index 903bfeb..51259f0 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStagingTaskModel.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/DataStagingTaskModel.java @@ -51,22 +51,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -/** - * DataStagingTaskModel: A structure holding the data staging task details. - * - * Source and Destination locations includes standard representation of protocol, host, port and path - * A friendly description of the task, usally used to communicate information to users. - * - */ @Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-10-12") public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStagingTaskModel, DataStagingTaskModel._Fields>, java.io.Serializable, Cloneable, Comparable<DataStagingTaskModel> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DataStagingTaskModel"); private static final org.apache.thrift.protocol.TField SOURCE_FIELD_DESC = new org.apache.thrift.protocol.TField("source", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField DESTINATION_FIELD_DESC = new org.apache.thrift.protocol.TField("destination", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField TRANSFER_START_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("transferStartTime", org.apache.thrift.protocol.TType.I64, (short)3); - private static final org.apache.thrift.protocol.TField TRANSFER_END_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("transferEndTime", org.apache.thrift.protocol.TType.I64, (short)4); - private static final org.apache.thrift.protocol.TField TRANSFER_RATE_FIELD_DESC = new org.apache.thrift.protocol.TField("transferRate", org.apache.thrift.protocol.TType.STRING, (short)5); + private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)3); + private static final org.apache.thrift.protocol.TField TRANSFER_START_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("transferStartTime", org.apache.thrift.protocol.TType.I64, (short)4); + private static final org.apache.thrift.protocol.TField TRANSFER_END_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("transferEndTime", org.apache.thrift.protocol.TType.I64, (short)5); + private static final org.apache.thrift.protocol.TField TRANSFER_RATE_FIELD_DESC = new org.apache.thrift.protocol.TField("transferRate", org.apache.thrift.protocol.TType.STRING, (short)6); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -76,6 +70,7 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging private String source; // required private String destination; // required + private DataStageType type; // required private long transferStartTime; // optional private long transferEndTime; // optional private String transferRate; // optional @@ -84,9 +79,14 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging public enum _Fields implements org.apache.thrift.TFieldIdEnum { SOURCE((short)1, "source"), DESTINATION((short)2, "destination"), - TRANSFER_START_TIME((short)3, "transferStartTime"), - TRANSFER_END_TIME((short)4, "transferEndTime"), - TRANSFER_RATE((short)5, "transferRate"); + /** + * + * @see DataStageType + */ + TYPE((short)3, "type"), + TRANSFER_START_TIME((short)4, "transferStartTime"), + TRANSFER_END_TIME((short)5, "transferEndTime"), + TRANSFER_RATE((short)6, "transferRate"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -105,11 +105,13 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging return SOURCE; case 2: // DESTINATION return DESTINATION; - case 3: // TRANSFER_START_TIME + case 3: // TYPE + return TYPE; + case 4: // TRANSFER_START_TIME return TRANSFER_START_TIME; - case 4: // TRANSFER_END_TIME + case 5: // TRANSFER_END_TIME return TRANSFER_END_TIME; - case 5: // TRANSFER_RATE + case 6: // TRANSFER_RATE return TRANSFER_RATE; default: return null; @@ -162,6 +164,8 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.DESTINATION, new org.apache.thrift.meta_data.FieldMetaData("destination", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, DataStageType.class))); tmpMap.put(_Fields.TRANSFER_START_TIME, new org.apache.thrift.meta_data.FieldMetaData("transferStartTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.TRANSFER_END_TIME, new org.apache.thrift.meta_data.FieldMetaData("transferEndTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, @@ -177,11 +181,13 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging public DataStagingTaskModel( String source, - String destination) + String destination, + DataStageType type) { this(); this.source = source; this.destination = destination; + this.type = type; } /** @@ -195,6 +201,9 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging if (other.isSetDestination()) { this.destination = other.destination; } + if (other.isSetType()) { + this.type = other.type; + } this.transferStartTime = other.transferStartTime; this.transferEndTime = other.transferEndTime; if (other.isSetTransferRate()) { @@ -210,6 +219,7 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging public void clear() { this.source = null; this.destination = null; + this.type = null; setTransferStartTimeIsSet(false); this.transferStartTime = 0; setTransferEndTimeIsSet(false); @@ -263,6 +273,37 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging } } + /** + * + * @see DataStageType + */ + public DataStageType getType() { + return this.type; + } + + /** + * + * @see DataStageType + */ + public void setType(DataStageType type) { + this.type = type; + } + + public void unsetType() { + this.type = null; + } + + /** Returns true if field type is set (has been assigned a value) and false otherwise */ + public boolean isSetType() { + return this.type != null; + } + + public void setTypeIsSet(boolean value) { + if (!value) { + this.type = null; + } + } + public long getTransferStartTime() { return this.transferStartTime; } @@ -348,6 +389,14 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging } break; + case TYPE: + if (value == null) { + unsetType(); + } else { + setType((DataStageType)value); + } + break; + case TRANSFER_START_TIME: if (value == null) { unsetTransferStartTime(); @@ -383,6 +432,9 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging case DESTINATION: return getDestination(); + case TYPE: + return getType(); + case TRANSFER_START_TIME: return Long.valueOf(getTransferStartTime()); @@ -407,6 +459,8 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging return isSetSource(); case DESTINATION: return isSetDestination(); + case TYPE: + return isSetType(); case TRANSFER_START_TIME: return isSetTransferStartTime(); case TRANSFER_END_TIME: @@ -448,6 +502,15 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging return false; } + boolean this_present_type = true && this.isSetType(); + boolean that_present_type = true && that.isSetType(); + if (this_present_type || that_present_type) { + if (!(this_present_type && that_present_type)) + return false; + if (!this.type.equals(that.type)) + return false; + } + boolean this_present_transferStartTime = true && this.isSetTransferStartTime(); boolean that_present_transferStartTime = true && that.isSetTransferStartTime(); if (this_present_transferStartTime || that_present_transferStartTime) { @@ -492,6 +555,11 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging if (present_destination) list.add(destination); + boolean present_type = true && (isSetType()); + list.add(present_type); + if (present_type) + list.add(type.getValue()); + boolean present_transferStartTime = true && (isSetTransferStartTime()); list.add(present_transferStartTime); if (present_transferStartTime) @@ -538,6 +606,16 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging return lastComparison; } } + lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetType()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type); + if (lastComparison != 0) { + return lastComparison; + } + } lastComparison = Boolean.valueOf(isSetTransferStartTime()).compareTo(other.isSetTransferStartTime()); if (lastComparison != 0) { return lastComparison; @@ -603,6 +681,14 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging sb.append(this.destination); } first = false; + if (!first) sb.append(", "); + sb.append("type:"); + if (this.type == null) { + sb.append("null"); + } else { + sb.append(this.type); + } + first = false; if (isSetTransferStartTime()) { if (!first) sb.append(", "); sb.append("transferStartTime:"); @@ -639,6 +725,10 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging throw new org.apache.thrift.protocol.TProtocolException("Required field 'destination' is unset! Struct:" + toString()); } + if (!isSetType()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' is unset! Struct:" + toString()); + } + // check for sub-struct validity } @@ -694,7 +784,15 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 3: // TRANSFER_START_TIME + case 3: // TYPE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.type = org.apache.airavata.model.task.DataStageType.findByValue(iprot.readI32()); + struct.setTypeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // TRANSFER_START_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.transferStartTime = iprot.readI64(); struct.setTransferStartTimeIsSet(true); @@ -702,7 +800,7 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 4: // TRANSFER_END_TIME + case 5: // TRANSFER_END_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.transferEndTime = iprot.readI64(); struct.setTransferEndTimeIsSet(true); @@ -710,7 +808,7 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 5: // TRANSFER_RATE + case 6: // TRANSFER_RATE if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.transferRate = iprot.readString(); struct.setTransferRateIsSet(true); @@ -741,6 +839,11 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging oprot.writeString(struct.destination); oprot.writeFieldEnd(); } + if (struct.type != null) { + oprot.writeFieldBegin(TYPE_FIELD_DESC); + oprot.writeI32(struct.type.getValue()); + oprot.writeFieldEnd(); + } if (struct.isSetTransferStartTime()) { oprot.writeFieldBegin(TRANSFER_START_TIME_FIELD_DESC); oprot.writeI64(struct.transferStartTime); @@ -777,6 +880,7 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeString(struct.source); oprot.writeString(struct.destination); + oprot.writeI32(struct.type.getValue()); BitSet optionals = new BitSet(); if (struct.isSetTransferStartTime()) { optionals.set(0); @@ -806,6 +910,8 @@ public class DataStagingTaskModel implements org.apache.thrift.TBase<DataStaging struct.setSourceIsSet(true); struct.destination = iprot.readString(); struct.setDestinationIsSet(true); + struct.type = org.apache.airavata.model.task.DataStageType.findByValue(iprot.readI32()); + struct.setTypeIsSet(true); BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.transferStartTime = iprot.readI64(); http://git-wip-us.apache.org/repos/asf/airavata/blob/af295229/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/JobSubmissionTaskModel.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/JobSubmissionTaskModel.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/JobSubmissionTaskModel.java new file mode 100644 index 0000000..c33209d --- /dev/null +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/task/JobSubmissionTaskModel.java @@ -0,0 +1,418 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.task; + +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-10-12") +public class JobSubmissionTaskModel implements org.apache.thrift.TBase<JobSubmissionTaskModel, JobSubmissionTaskModel._Fields>, java.io.Serializable, Cloneable, Comparable<JobSubmissionTaskModel> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JobSubmissionTaskModel"); + + private static final org.apache.thrift.protocol.TField MONITOR_MODE_FIELD_DESC = new org.apache.thrift.protocol.TField("monitorMode", org.apache.thrift.protocol.TType.I32, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new JobSubmissionTaskModelStandardSchemeFactory()); + schemes.put(TupleScheme.class, new JobSubmissionTaskModelTupleSchemeFactory()); + } + + private org.apache.airavata.model.appcatalog.computeresource.MonitorMode monitorMode; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + /** + * + * @see org.apache.airavata.model.appcatalog.computeresource.MonitorMode + */ + MONITOR_MODE((short)1, "monitorMode"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // MONITOR_MODE + return MONITOR_MODE; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.MONITOR_MODE, new org.apache.thrift.meta_data.FieldMetaData("monitorMode", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, org.apache.airavata.model.appcatalog.computeresource.MonitorMode.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(JobSubmissionTaskModel.class, metaDataMap); + } + + public JobSubmissionTaskModel() { + } + + public JobSubmissionTaskModel( + org.apache.airavata.model.appcatalog.computeresource.MonitorMode monitorMode) + { + this(); + this.monitorMode = monitorMode; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public JobSubmissionTaskModel(JobSubmissionTaskModel other) { + if (other.isSetMonitorMode()) { + this.monitorMode = other.monitorMode; + } + } + + public JobSubmissionTaskModel deepCopy() { + return new JobSubmissionTaskModel(this); + } + + @Override + public void clear() { + this.monitorMode = null; + } + + /** + * + * @see org.apache.airavata.model.appcatalog.computeresource.MonitorMode + */ + public org.apache.airavata.model.appcatalog.computeresource.MonitorMode getMonitorMode() { + return this.monitorMode; + } + + /** + * + * @see org.apache.airavata.model.appcatalog.computeresource.MonitorMode + */ + public void setMonitorMode(org.apache.airavata.model.appcatalog.computeresource.MonitorMode monitorMode) { + this.monitorMode = monitorMode; + } + + public void unsetMonitorMode() { + this.monitorMode = null; + } + + /** Returns true if field monitorMode is set (has been assigned a value) and false otherwise */ + public boolean isSetMonitorMode() { + return this.monitorMode != null; + } + + public void setMonitorModeIsSet(boolean value) { + if (!value) { + this.monitorMode = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case MONITOR_MODE: + if (value == null) { + unsetMonitorMode(); + } else { + setMonitorMode((org.apache.airavata.model.appcatalog.computeresource.MonitorMode)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case MONITOR_MODE: + return getMonitorMode(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case MONITOR_MODE: + return isSetMonitorMode(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof JobSubmissionTaskModel) + return this.equals((JobSubmissionTaskModel)that); + return false; + } + + public boolean equals(JobSubmissionTaskModel that) { + if (that == null) + return false; + + boolean this_present_monitorMode = true && this.isSetMonitorMode(); + boolean that_present_monitorMode = true && that.isSetMonitorMode(); + if (this_present_monitorMode || that_present_monitorMode) { + if (!(this_present_monitorMode && that_present_monitorMode)) + return false; + if (!this.monitorMode.equals(that.monitorMode)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_monitorMode = true && (isSetMonitorMode()); + list.add(present_monitorMode); + if (present_monitorMode) + list.add(monitorMode.getValue()); + + return list.hashCode(); + } + + @Override + public int compareTo(JobSubmissionTaskModel other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetMonitorMode()).compareTo(other.isSetMonitorMode()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetMonitorMode()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.monitorMode, other.monitorMode); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("JobSubmissionTaskModel("); + boolean first = true; + + sb.append("monitorMode:"); + if (this.monitorMode == null) { + sb.append("null"); + } else { + sb.append(this.monitorMode); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (!isSetMonitorMode()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'monitorMode' is unset! Struct:" + toString()); + } + + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class JobSubmissionTaskModelStandardSchemeFactory implements SchemeFactory { + public JobSubmissionTaskModelStandardScheme getScheme() { + return new JobSubmissionTaskModelStandardScheme(); + } + } + + private static class JobSubmissionTaskModelStandardScheme extends StandardScheme<JobSubmissionTaskModel> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, JobSubmissionTaskModel struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // MONITOR_MODE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.monitorMode = org.apache.airavata.model.appcatalog.computeresource.MonitorMode.findByValue(iprot.readI32()); + struct.setMonitorModeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, JobSubmissionTaskModel struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.monitorMode != null) { + oprot.writeFieldBegin(MONITOR_MODE_FIELD_DESC); + oprot.writeI32(struct.monitorMode.getValue()); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class JobSubmissionTaskModelTupleSchemeFactory implements SchemeFactory { + public JobSubmissionTaskModelTupleScheme getScheme() { + return new JobSubmissionTaskModelTupleScheme(); + } + } + + private static class JobSubmissionTaskModelTupleScheme extends TupleScheme<JobSubmissionTaskModel> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, JobSubmissionTaskModel struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeI32(struct.monitorMode.getValue()); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, JobSubmissionTaskModel struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.monitorMode = org.apache.airavata.model.appcatalog.computeresource.MonitorMode.findByValue(iprot.readI32()); + struct.setMonitorModeIsSet(true); + } + } + +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/af295229/modules/commons/src/main/java/org/apache/airavata/common/utils/ThriftUtils.java ---------------------------------------------------------------------- diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/ThriftUtils.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/ThriftUtils.java index b13ef24..7b3189d 100644 --- a/modules/commons/src/main/java/org/apache/airavata/common/utils/ThriftUtils.java +++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/ThriftUtils.java @@ -22,6 +22,7 @@ package org.apache.airavata.common.utils; import org.apache.airavata.model.task.DataStagingTaskModel; +import org.apache.airavata.model.task.EnvironmentSetupTaskModel; import org.apache.airavata.model.task.TaskModel; import org.apache.thrift.TBase; import org.apache.thrift.TDeserializer; @@ -44,7 +45,9 @@ public class ThriftUtils { ThriftUtils.createThriftFromBytes(taskModel.getSubTaskModel(), dataStagingTaskModel); return dataStagingTaskModel; case ENV_SETUP: - // TODO return Environment Setup task model + EnvironmentSetupTaskModel environmentSetupTaskModel = new EnvironmentSetupTaskModel(); + ThriftUtils.createThriftFromBytes(taskModel.getSubTaskModel(), environmentSetupTaskModel); + return environmentSetupTaskModel; case JOB_SUBMISSION: // TODO return Job Submission task model case MONITORING: http://git-wip-us.apache.org/repos/asf/airavata/blob/af295229/thrift-interface-descriptions/airavata-api/task_model.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/airavata-api/task_model.thrift b/thrift-interface-descriptions/airavata-api/task_model.thrift index f93aa81..c4051ac 100644 --- a/thrift-interface-descriptions/airavata-api/task_model.thrift +++ b/thrift-interface-descriptions/airavata-api/task_model.thrift @@ -67,12 +67,19 @@ struct TaskModel { * A friendly description of the task, usally used to communicate information to users. * */ + +enum DataStageType { + INPUT, + OUPUT + +} struct DataStagingTaskModel { 1: required string source, 2: required string destination, - 3: optional i64 transferStartTime, - 4: optional i64 transferEndTime, - 5: optional string transferRate + 3: required DataStageType type, + 4: optional i64 transferStartTime, + 5: optional i64 transferEndTime, + 6: optional string transferRate } /** @@ -81,4 +88,9 @@ struct DataStagingTaskModel { struct EnvironmentSetupTaskModel { 1: required string location, 2: required compute_resource_model.SecurityProtocol protocol +} + + +struct JobSubmissionTaskModel { + 1: required compute_resource_model.MonitorMode monitorMode } \ No newline at end of file
