modify timeout of version check subprocess to 3s

Signed-off-by: zhoufeng <zhoufeng54@huawei.com>
This commit is contained in:
zhoufeng 2020-12-11 13:40:02 +08:00
parent 677072ace6
commit ad1e49b7a3
6 changed files with 18 additions and 4 deletions

View File

@ -30,6 +30,7 @@ class MS_API Graph {
class GraphData;
explicit Graph(const std::shared_ptr<GraphData> &graph_data);
explicit Graph(std::shared_ptr<GraphData> &&graph_data);
~Graph();
enum ModelType ModelType() const;

View File

@ -190,15 +190,21 @@ class AscendEnvChecker(EnvChecker):
"match, reference to the match info on: https://www.mindspore.cn/install")
def check_deps_version(self):
# in order to update the change of 'LD_LIBRARY_PATH' env, run a sub process
"""
te, topi, hccl wheel package version check
in order to update the change of 'LD_LIBRARY_PATH' env, run a sub process
"""
input_args = ["--mindspore_version=" + __version__]
for v in self.version:
input_args.append("--supported_version=" + v)
deps_version_checker = os.path.join(os.path.split(os.path.realpath(__file__))[0], "_check_deps_version.py")
call_cmd = [sys.executable, deps_version_checker] + input_args
process = subprocess.run(call_cmd, timeout=300, text=True, capture_output=True, check=False)
try:
process = subprocess.run(call_cmd, timeout=3, text=True, capture_output=True, check=False)
if process.stdout.strip() != "":
logger.warning(process.stdout.strip())
except subprocess.TimeoutExpired:
logger.warning("Package te, topi, hccl version check timed out, skip.")
def set_env(self):
if not self.tbe_path:

View File

@ -20,6 +20,7 @@ namespace mindspore::api {
class Context::ContextImpl {
public:
ContextImpl() : device_target_("NotSet"), device_id_(0) {}
~ContextImpl() = default;
const std::string &GetDeviceTarget() const { return device_target_; }
void SetDeviceTarget(std::string_view device_target) { device_target_ = device_target; }
uint32_t GetDeviceID() const { return device_id_; }

View File

@ -22,6 +22,8 @@ Graph::Graph(const std::shared_ptr<GraphData> &graph_data) : graph_data_(graph_d
Graph::Graph(std::shared_ptr<GraphData> &&graph_data) : graph_data_(graph_data) {}
Graph::~Graph() {}
ModelType Graph::ModelType() const {
MS_EXCEPTION_IF_NULL(graph_data_);
return graph_data_->ModelType();

View File

@ -53,6 +53,8 @@ Graph::GraphData::GraphData(Buffer om_data, enum ModelType model_type)
#endif
}
Graph::GraphData::~GraphData() {}
FuncGraphPtr Graph::GraphData::GetFuncGraph() const {
if (model_type_ != ModelType::kMindIR) {
MS_LOG(ERROR) << "Invalid ModelType " << model_type_;

View File

@ -33,6 +33,8 @@ class Graph::GraphData {
GraphData(Buffer om_data, enum ModelType model_type);
~GraphData();
enum ModelType ModelType() const { return model_type_; }
FuncGraphPtr GetFuncGraph() const;