| 12 | namespace { |
| 13 | constexpr int DEFAULT_CPUS = 8; |
| 14 | Status AddOSSAccessPrefix(std::string& dir, |
| 15 | const ModelConfig* config) { |
| 16 | auto offset = dir.find("oss://"); |
| 17 | // error oss format |
| 18 | if (offset == std::string::npos) { |
| 19 | return tensorflow::errors::Internal( |
| 20 | "Invalid user input oss dir, ", dir); |
| 21 | } |
| 22 | |
| 23 | std::string tmp(dir.substr(6)); |
| 24 | offset = tmp.find("/"); |
| 25 | if (offset == std::string::npos) { |
| 26 | return tensorflow::errors::Internal( |
| 27 | "Invalid user input oss dir, ", dir); |
| 28 | } |
| 29 | |
| 30 | dir = strings::StrCat(dir.substr(0, offset+6), |
| 31 | "\x01id=", config->oss_access_id, |
| 32 | "\x02key=", config->oss_access_key, |
| 33 | "\x02host=", config->oss_endpoint, |
| 34 | tmp.substr(offset)); |
| 35 | return Status::OK(); |
| 36 | } |
| 37 | |
| 38 | void ParseGPUIds(const std::string& gpu_ids_list, |
| 39 | std::vector<size_t>* gpu_ids) { |