mirror of
https://github.com/CHN-beta/hpcstat.git
synced 2026-01-11 02:09:24 +08:00
minor fixes
This commit is contained in:
@@ -61,9 +61,9 @@ namespace hpcstat::sql
|
|||||||
unsigned Id = 0;
|
unsigned Id = 0;
|
||||||
long Time;
|
long Time;
|
||||||
unsigned JobId;
|
unsigned JobId;
|
||||||
std::string JobResult, SubmitTime, Signature = "";
|
std::string JobResult, SubmitTime, JobDetail, Signature = "";
|
||||||
double CpuTime;
|
double CpuTime;
|
||||||
using serialize = zpp::bits::members<7>;
|
using serialize = zpp::bits::members<8>;
|
||||||
};
|
};
|
||||||
using FinishJobTable = zxorm::Table
|
using FinishJobTable = zxorm::Table
|
||||||
<
|
<
|
||||||
@@ -73,6 +73,7 @@ namespace hpcstat::sql
|
|||||||
zxorm::Column<"job_id", &FinishJobData::JobId>,
|
zxorm::Column<"job_id", &FinishJobData::JobId>,
|
||||||
zxorm::Column<"job_result", &FinishJobData::JobResult>,
|
zxorm::Column<"job_result", &FinishJobData::JobResult>,
|
||||||
zxorm::Column<"submit_time", &FinishJobData::SubmitTime>,
|
zxorm::Column<"submit_time", &FinishJobData::SubmitTime>,
|
||||||
|
zxorm::Column<"job_detail", &FinishJobData::JobDetail>,
|
||||||
zxorm::Column<"signature", &FinishJobData::Signature>,
|
zxorm::Column<"signature", &FinishJobData::Signature>,
|
||||||
zxorm::Column<"cpu_time", &FinishJobData::CpuTime>
|
zxorm::Column<"cpu_time", &FinishJobData::CpuTime>
|
||||||
>;
|
>;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace hpcstat::lfs
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::set<std::string> valid_args = { "J" "q" "n" "R" "o" };
|
std::set<std::string> valid_args = { "J", "q", "n", "R", "o" };
|
||||||
for (auto it = args.begin(); it != args.end(); it++)
|
for (auto it = args.begin(); it != args.end(); it++)
|
||||||
{
|
{
|
||||||
if (it->length() > 0 && (*it)[0] == '-')
|
if (it->length() > 0 && (*it)[0] == '-')
|
||||||
@@ -29,11 +29,11 @@ namespace hpcstat::lfs
|
|||||||
"please submit issue on [github](https://github.com/CHN-beta/hpcstat) or contact chn@chn.moe.\n";
|
"please submit issue on [github](https://github.com/CHN-beta/hpcstat) or contact chn@chn.moe.\n";
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
if (it + 1 != args.end() && ((it + 1)->length() == 0 || (*(it + 1))[0] != '-')) it++;
|
else if (it + 1 != args.end() && ((it + 1)->length() == 0 || (*(it + 1))[0] != '-')) it++;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
if (auto result = exec(*bsub, args); result) return std::nullopt;
|
if (auto result = exec(*bsub, args); !result) return std::nullopt;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Job <462270> is submitted to queue <normal_1day>.
|
// Job <462270> is submitted to queue <normal_1day>.
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ int main(int argc, const char** argv)
|
|||||||
}
|
}
|
||||||
else if (args[1] == "login")
|
else if (args[1] == "login")
|
||||||
{
|
{
|
||||||
std::cout << "Communicating with the agent..." << std::flush;
|
if (env::interactive()) std::cout << "Communicating with the agent..." << std::flush;
|
||||||
if (auto fp = ssh::fingerprint(); !fp) return 1;
|
if (auto fp = ssh::fingerprint(); !fp) return 1;
|
||||||
else if (auto session = env::env("XDG_SESSION_ID", true); !session)
|
else if (auto session = env::env("XDG_SESSION_ID", true); !session)
|
||||||
return 1;
|
return 1;
|
||||||
@@ -34,7 +34,7 @@ int main(int argc, const char** argv)
|
|||||||
if (!signature) return 1;
|
if (!signature) return 1;
|
||||||
data.Signature = *signature;
|
data.Signature = *signature;
|
||||||
sql::writedb(data);
|
sql::writedb(data);
|
||||||
std::cout << fmt::format("\33[2K\rLogged in as {}.\n", Keys[*fp].Username);
|
if (env::interactive()) std::cout << fmt::format("\33[2K\rLogged in as {}.\n", Keys[*fp].Username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args[1] == "logout")
|
else if (args[1] == "logout")
|
||||||
@@ -66,7 +66,7 @@ int main(int argc, const char** argv)
|
|||||||
data.Signature = *signature;
|
data.Signature = *signature;
|
||||||
sql::writedb(data);
|
sql::writedb(data);
|
||||||
std::cout << fmt::format
|
std::cout << fmt::format
|
||||||
("Job {} was submitted to {} by {}.\n", bsub->first, bsub->second, Keys[*fp].Username);
|
("Job <{}> was submitted to <{}> by <{}>.\n", bsub->first, bsub->second, Keys[*fp].Username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args[1] == "finishjob")
|
else if (args[1] == "finishjob")
|
||||||
@@ -94,7 +94,8 @@ int main(int argc, const char** argv)
|
|||||||
sql::FinishJobData data
|
sql::FinishJobData data
|
||||||
{
|
{
|
||||||
.Time = now(), .JobId = jobid, .JobResult = std::get<1>(all_jobs->at(jobid)),
|
.Time = now(), .JobId = jobid, .JobResult = std::get<1>(all_jobs->at(jobid)),
|
||||||
.SubmitTime = std::get<1>(all_jobs->at(jobid)), .CpuTime = std::get<2>(all_jobs->at(jobid)),
|
.SubmitTime = std::get<0>(all_jobs->at(jobid)), .JobDetail = *detail,
|
||||||
|
.CpuTime = std::get<2>(all_jobs->at(jobid)),
|
||||||
};
|
};
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in New Issue
Block a user