diff --git a/VERSION b/VERSION index 5ed949724..9e6e7f1ae 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1342 \ No newline at end of file +1.36.1343 \ No newline at end of file diff --git a/ehpc/CMakeLists.txt b/ehpc/CMakeLists.txt index 939f57486..9eaa93309 100644 --- a/ehpc/CMakeLists.txt +++ b/ehpc/CMakeLists.txt @@ -123,6 +123,8 @@ set(ehpc_public_header_model include/alibabacloud/ehpc/model/GetHybridClusterConfigResult.h include/alibabacloud/ehpc/model/GetIfEcsTypeSupportHtConfigRequest.h include/alibabacloud/ehpc/model/GetIfEcsTypeSupportHtConfigResult.h + include/alibabacloud/ehpc/model/GetJobLogRequest.h + include/alibabacloud/ehpc/model/GetJobLogResult.h include/alibabacloud/ehpc/model/GetPostScriptsRequest.h include/alibabacloud/ehpc/model/GetPostScriptsResult.h include/alibabacloud/ehpc/model/GetSchedulerInfoRequest.h @@ -390,6 +392,8 @@ set(ehpc_src src/model/GetHybridClusterConfigResult.cc src/model/GetIfEcsTypeSupportHtConfigRequest.cc src/model/GetIfEcsTypeSupportHtConfigResult.cc + src/model/GetJobLogRequest.cc + src/model/GetJobLogResult.cc src/model/GetPostScriptsRequest.cc src/model/GetPostScriptsResult.cc src/model/GetSchedulerInfoRequest.cc diff --git a/ehpc/include/alibabacloud/ehpc/EHPCClient.h b/ehpc/include/alibabacloud/ehpc/EHPCClient.h index 1e98c4007..72b29839c 100644 --- a/ehpc/include/alibabacloud/ehpc/EHPCClient.h +++ b/ehpc/include/alibabacloud/ehpc/EHPCClient.h @@ -124,6 +124,8 @@ #include "model/GetHybridClusterConfigResult.h" #include "model/GetIfEcsTypeSupportHtConfigRequest.h" #include "model/GetIfEcsTypeSupportHtConfigResult.h" +#include "model/GetJobLogRequest.h" +#include "model/GetJobLogResult.h" #include "model/GetPostScriptsRequest.h" #include "model/GetPostScriptsResult.h" #include "model/GetSchedulerInfoRequest.h" @@ -448,6 +450,9 @@ namespace AlibabaCloud typedef Outcome GetIfEcsTypeSupportHtConfigOutcome; typedef std::future GetIfEcsTypeSupportHtConfigOutcomeCallable; typedef std::function&)> GetIfEcsTypeSupportHtConfigAsyncHandler; + typedef Outcome GetJobLogOutcome; + typedef std::future GetJobLogOutcomeCallable; + typedef std::function&)> GetJobLogAsyncHandler; typedef Outcome GetPostScriptsOutcome; typedef std::future GetPostScriptsOutcomeCallable; typedef std::function&)> GetPostScriptsAsyncHandler; @@ -849,6 +854,9 @@ namespace AlibabaCloud GetIfEcsTypeSupportHtConfigOutcome getIfEcsTypeSupportHtConfig(const Model::GetIfEcsTypeSupportHtConfigRequest &request)const; void getIfEcsTypeSupportHtConfigAsync(const Model::GetIfEcsTypeSupportHtConfigRequest& request, const GetIfEcsTypeSupportHtConfigAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GetIfEcsTypeSupportHtConfigOutcomeCallable getIfEcsTypeSupportHtConfigCallable(const Model::GetIfEcsTypeSupportHtConfigRequest& request) const; + GetJobLogOutcome getJobLog(const Model::GetJobLogRequest &request)const; + void getJobLogAsync(const Model::GetJobLogRequest& request, const GetJobLogAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetJobLogOutcomeCallable getJobLogCallable(const Model::GetJobLogRequest& request) const; GetPostScriptsOutcome getPostScripts(const Model::GetPostScriptsRequest &request)const; void getPostScriptsAsync(const Model::GetPostScriptsRequest& request, const GetPostScriptsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GetPostScriptsOutcomeCallable getPostScriptsCallable(const Model::GetPostScriptsRequest& request) const; diff --git a/ehpc/include/alibabacloud/ehpc/model/GetJobLogRequest.h b/ehpc/include/alibabacloud/ehpc/model/GetJobLogRequest.h new file mode 100644 index 000000000..e0147721d --- /dev/null +++ b/ehpc/include/alibabacloud/ehpc/model/GetJobLogRequest.h @@ -0,0 +1,57 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed 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. + */ + +#ifndef ALIBABACLOUD_EHPC_MODEL_GETJOBLOGREQUEST_H_ +#define ALIBABACLOUD_EHPC_MODEL_GETJOBLOGREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace EHPC { +namespace Model { +class ALIBABACLOUD_EHPC_EXPORT GetJobLogRequest : public RpcServiceRequest { +public: + GetJobLogRequest(); + ~GetJobLogRequest(); + long getOffset() const; + void setOffset(long offset); + std::string getExecHost() const; + void setExecHost(const std::string &execHost); + std::string getClusterId() const; + void setClusterId(const std::string &clusterId); + std::string getAccessKeyId() const; + void setAccessKeyId(const std::string &accessKeyId); + std::string getJobId() const; + void setJobId(const std::string &jobId); + int getSize() const; + void setSize(int size); + +private: + long offset_; + std::string execHost_; + std::string clusterId_; + std::string accessKeyId_; + std::string jobId_; + int size_; +}; +} // namespace Model +} // namespace EHPC +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_EHPC_MODEL_GETJOBLOGREQUEST_H_ diff --git a/ehpc/include/alibabacloud/ehpc/model/GetJobLogResult.h b/ehpc/include/alibabacloud/ehpc/model/GetJobLogResult.h new file mode 100644 index 000000000..a9664cb55 --- /dev/null +++ b/ehpc/include/alibabacloud/ehpc/model/GetJobLogResult.h @@ -0,0 +1,55 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed 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. + */ + +#ifndef ALIBABACLOUD_EHPC_MODEL_GETJOBLOGRESULT_H_ +#define ALIBABACLOUD_EHPC_MODEL_GETJOBLOGRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace EHPC + { + namespace Model + { + class ALIBABACLOUD_EHPC_EXPORT GetJobLogResult : public ServiceResult + { + public: + + + GetJobLogResult(); + explicit GetJobLogResult(const std::string &payload); + ~GetJobLogResult(); + std::string getOutputLog()const; + std::string getErrorLog()const; + std::string getJobId()const; + + protected: + void parse(const std::string &payload); + private: + std::string outputLog_; + std::string errorLog_; + std::string jobId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_EHPC_MODEL_GETJOBLOGRESULT_H_ \ No newline at end of file diff --git a/ehpc/src/EHPCClient.cc b/ehpc/src/EHPCClient.cc index 747affdf8..82317ccc0 100644 --- a/ehpc/src/EHPCClient.cc +++ b/ehpc/src/EHPCClient.cc @@ -1887,6 +1887,42 @@ EHPCClient::GetIfEcsTypeSupportHtConfigOutcomeCallable EHPCClient::getIfEcsTypeS return task->get_future(); } +EHPCClient::GetJobLogOutcome EHPCClient::getJobLog(const GetJobLogRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetJobLogOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetJobLogOutcome(GetJobLogResult(outcome.result())); + else + return GetJobLogOutcome(outcome.error()); +} + +void EHPCClient::getJobLogAsync(const GetJobLogRequest& request, const GetJobLogAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getJobLog(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +EHPCClient::GetJobLogOutcomeCallable EHPCClient::getJobLogCallable(const GetJobLogRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getJobLog(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + EHPCClient::GetPostScriptsOutcome EHPCClient::getPostScripts(const GetPostScriptsRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/ehpc/src/model/GetJobLogRequest.cc b/ehpc/src/model/GetJobLogRequest.cc new file mode 100644 index 000000000..5d6b78237 --- /dev/null +++ b/ehpc/src/model/GetJobLogRequest.cc @@ -0,0 +1,81 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed 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. + */ + +#include + +using AlibabaCloud::EHPC::Model::GetJobLogRequest; + +GetJobLogRequest::GetJobLogRequest() + : RpcServiceRequest("ehpc", "2018-04-12", "GetJobLog") { + setMethod(HttpRequest::Method::Get); +} + +GetJobLogRequest::~GetJobLogRequest() {} + +long GetJobLogRequest::getOffset() const { + return offset_; +} + +void GetJobLogRequest::setOffset(long offset) { + offset_ = offset; + setParameter(std::string("Offset"), std::to_string(offset)); +} + +std::string GetJobLogRequest::getExecHost() const { + return execHost_; +} + +void GetJobLogRequest::setExecHost(const std::string &execHost) { + execHost_ = execHost; + setParameter(std::string("ExecHost"), execHost); +} + +std::string GetJobLogRequest::getClusterId() const { + return clusterId_; +} + +void GetJobLogRequest::setClusterId(const std::string &clusterId) { + clusterId_ = clusterId; + setParameter(std::string("ClusterId"), clusterId); +} + +std::string GetJobLogRequest::getAccessKeyId() const { + return accessKeyId_; +} + +void GetJobLogRequest::setAccessKeyId(const std::string &accessKeyId) { + accessKeyId_ = accessKeyId; + setParameter(std::string("AccessKeyId"), accessKeyId); +} + +std::string GetJobLogRequest::getJobId() const { + return jobId_; +} + +void GetJobLogRequest::setJobId(const std::string &jobId) { + jobId_ = jobId; + setParameter(std::string("JobId"), jobId); +} + +int GetJobLogRequest::getSize() const { + return size_; +} + +void GetJobLogRequest::setSize(int size) { + size_ = size; + setParameter(std::string("Size"), std::to_string(size)); +} + diff --git a/ehpc/src/model/GetJobLogResult.cc b/ehpc/src/model/GetJobLogResult.cc new file mode 100644 index 000000000..efbdfdd45 --- /dev/null +++ b/ehpc/src/model/GetJobLogResult.cc @@ -0,0 +1,65 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed 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. + */ + +#include +#include + +using namespace AlibabaCloud::EHPC; +using namespace AlibabaCloud::EHPC::Model; + +GetJobLogResult::GetJobLogResult() : + ServiceResult() +{} + +GetJobLogResult::GetJobLogResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetJobLogResult::~GetJobLogResult() +{} + +void GetJobLogResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["JobId"].isNull()) + jobId_ = value["JobId"].asString(); + if(!value["OutputLog"].isNull()) + outputLog_ = value["OutputLog"].asString(); + if(!value["ErrorLog"].isNull()) + errorLog_ = value["ErrorLog"].asString(); + +} + +std::string GetJobLogResult::getOutputLog()const +{ + return outputLog_; +} + +std::string GetJobLogResult::getErrorLog()const +{ + return errorLog_; +} + +std::string GetJobLogResult::getJobId()const +{ + return jobId_; +} +