mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
fix node/tag bugs introduced with fs refactor
This commit is contained in:
parent
787f8f1681
commit
7c600c679f
@ -458,8 +458,8 @@ void Laminar::run() {
|
|||||||
const char* listen_http = getenv("LAMINAR_BIND_HTTP") ?: INTADDR_HTTP_DEFAULT;
|
const char* listen_http = getenv("LAMINAR_BIND_HTTP") ?: INTADDR_HTTP_DEFAULT;
|
||||||
|
|
||||||
srv = new Server(*this, listen_rpc, listen_http);
|
srv = new Server(*this, listen_rpc, listen_http);
|
||||||
srv->addWatchPath((homePath/"cfg"/"nodes").toString().cStr());
|
srv->addWatchPath((homePath/"cfg"/"nodes").toString(true).cStr());
|
||||||
srv->addWatchPath((homePath/"cfg"/"jobs").toString().cStr());
|
srv->addWatchPath((homePath/"cfg"/"jobs").toString(true).cStr());
|
||||||
srv->start();
|
srv->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,9 +478,9 @@ bool Laminar::loadConfiguration() {
|
|||||||
if(entry.type != kj::FsNode::Type::FILE || !entry.name.endsWith(".conf"))
|
if(entry.type != kj::FsNode::Type::FILE || !entry.name.endsWith(".conf"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
StringMap conf = parseConfFile((homePath/entry.name).toString().cStr());
|
StringMap conf = parseConfFile((homePath/"cfg"/"nodes"/entry.name).toString(true).cStr());
|
||||||
|
|
||||||
std::string nodeName(entry.name.cStr(), entry.name.findLast('.').orDefault(0)-1);
|
std::string nodeName(entry.name.cStr(), entry.name.findLast('.').orDefault(0));
|
||||||
auto existingNode = nodes.find(nodeName);
|
auto existingNode = nodes.find(nodeName);
|
||||||
std::shared_ptr<Node> node = existingNode == nodes.end() ? nodes.emplace(nodeName, std::shared_ptr<Node>(new Node)).first->second : existingNode->second;
|
std::shared_ptr<Node> node = existingNode == nodes.end() ? nodes.emplace(nodeName, std::shared_ptr<Node>(new Node)).first->second : existingNode->second;
|
||||||
node->name = nodeName;
|
node->name = nodeName;
|
||||||
@ -511,6 +511,7 @@ bool Laminar::loadConfiguration() {
|
|||||||
|
|
||||||
// add a default node
|
// add a default node
|
||||||
if(nodes.empty()) {
|
if(nodes.empty()) {
|
||||||
|
LLOG(INFO, "Creating a default node with 6 executors");
|
||||||
std::shared_ptr<Node> node(new Node);
|
std::shared_ptr<Node> node(new Node);
|
||||||
node->name = "";
|
node->name = "";
|
||||||
node->numExecutors = 6;
|
node->numExecutors = 6;
|
||||||
@ -521,9 +522,9 @@ bool Laminar::loadConfiguration() {
|
|||||||
for(kj::Directory::Entry& entry : (*jobsDir)->listEntries()) {
|
for(kj::Directory::Entry& entry : (*jobsDir)->listEntries()) {
|
||||||
if(entry.type != kj::FsNode::Type::FILE || !entry.name.endsWith(".conf"))
|
if(entry.type != kj::FsNode::Type::FILE || !entry.name.endsWith(".conf"))
|
||||||
continue;
|
continue;
|
||||||
StringMap conf = parseConfFile((homePath/entry.name).toString().cStr());
|
StringMap conf = parseConfFile((homePath/"cfg"/"jobs"/entry.name).toString(true).cStr());
|
||||||
|
|
||||||
std::string jobName(entry.name.cStr(), entry.name.findLast('.').orDefault(0)-1);
|
std::string jobName(entry.name.cStr(), entry.name.findLast('.').orDefault(0));
|
||||||
|
|
||||||
std::string tags = conf.get<std::string>("TAGS");
|
std::string tags = conf.get<std::string>("TAGS");
|
||||||
if(!tags.empty()) {
|
if(!tags.empty()) {
|
||||||
@ -568,6 +569,7 @@ std::shared_ptr<Run> Laminar::queueJob(std::string name, ParamMap params) {
|
|||||||
|
|
||||||
void Laminar::notifyConfigChanged()
|
void Laminar::notifyConfigChanged()
|
||||||
{
|
{
|
||||||
|
LLOG(INFO, "Reloading configuration");
|
||||||
loadConfiguration();
|
loadConfiguration();
|
||||||
// config change may allow stuck jobs to dequeue
|
// config change may allow stuck jobs to dequeue
|
||||||
assignNewJobs();
|
assignNewJobs();
|
||||||
|
Loading…
Reference in New Issue
Block a user