mirror of
https://gitlab.cs.uni-saarland.de/hpc/cc-condor-sync.git
synced 2024-12-26 05:29:06 +01:00
Fix AssignedGPUs
parsing.
This commit is contained in:
parent
80619b6154
commit
6128b58cbd
@ -17,10 +17,14 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
slot_gpu_map = {}
|
slot_gpu_map = {}
|
||||||
for slot in condor_status:
|
for slot in condor_status:
|
||||||
machine = slot["Machine"]
|
machine = slot["Machine"].split('.')[0]
|
||||||
gpu_map = {}
|
gpu_map = {}
|
||||||
if machine in slot_gpu_map:
|
if machine in slot_gpu_map:
|
||||||
gpu_map = slot_gpu_map[machine]
|
gpu_map = slot_gpu_map[machine]
|
||||||
|
else:
|
||||||
|
slot_gpu_map[machine] = {}
|
||||||
|
if not "AssignedGPUs" in slot:
|
||||||
|
continue
|
||||||
gpus = slot["AssignedGPUs"].split(',')
|
gpus = slot["AssignedGPUs"].split(',')
|
||||||
for gpu_id in gpus:
|
for gpu_id in gpus:
|
||||||
gpu = slot["GPUs_" + gpu_id.strip().replace("-", "_")]
|
gpu = slot["GPUs_" + gpu_id.strip().replace("-", "_")]
|
||||||
|
@ -267,12 +267,19 @@ std::string getRemoteHost(std::string_view slot) {
|
|||||||
return {++atIt, subIt};
|
return {++atIt, subIt};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string removeQuotes(const std::string &value) {
|
||||||
|
if (value[0] == '"' && value.back() == '"') {
|
||||||
|
return value.substr(1, value.size() - 2);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::string>
|
std::vector<std::string>
|
||||||
CCSyncPlugin::getAccelerators(const CondorJob &job,
|
CCSyncPlugin::getAccelerators(const CondorJob &job,
|
||||||
const std::string &hostname) {
|
const std::string &hostname) {
|
||||||
if (auto hostIt = gpuMap.find(hostname); hostIt != gpuMap.end()) {
|
if (auto hostIt = gpuMap.find(hostname); hostIt != gpuMap.end()) {
|
||||||
if (auto gpuIt = job.find("AssignedGPUs"); gpuIt != job.end()) {
|
if (auto gpuIt = job.find("AssignedGPUs"); gpuIt != job.end()) {
|
||||||
std::istringstream gpuStream{gpuIt->second};
|
std::istringstream gpuStream{removeQuotes(gpuIt->second)};
|
||||||
std::vector<std::string> gpus;
|
std::vector<std::string> gpus;
|
||||||
std::string gpu;
|
std::string gpu;
|
||||||
while (std::getline(gpuStream, gpu, ',')) {
|
while (std::getline(gpuStream, gpu, ',')) {
|
||||||
@ -313,13 +320,6 @@ bool jobHasRequiredClassAds(const CondorJob &job) {
|
|||||||
jobHasClassAd(job, "EnteredCurrentStatus");
|
jobHasClassAd(job, "EnteredCurrentStatus");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string removeQuotes(const std::string &value) {
|
|
||||||
if (value[0] == '"' && value.back() == '"') {
|
|
||||||
return value.substr(1, value.size() - 2);
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCSyncPlugin::sendPostRequest(const std::string &route,
|
void CCSyncPlugin::sendPostRequest(const std::string &route,
|
||||||
const std::string &body) const noexcept {
|
const std::string &body) const noexcept {
|
||||||
dprintf(D_VERBOSE, "POST body: %s\n", body.c_str());
|
dprintf(D_VERBOSE, "POST body: %s\n", body.c_str());
|
||||||
|
Loading…
Reference in New Issue
Block a user