From eaa834e8f8a0ee78ef7159c3775e35f30e4f38eb Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Wed, 11 Dec 2024 22:05:34 +0800 Subject: [PATCH] feat: allow set max runners for nodes --- .github/workflows/docker-crawlab.yml | 5 ----- core/task/handler/service.go | 4 ++-- core/utils/config.go | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-crawlab.yml b/.github/workflows/docker-crawlab.yml index ea5b8621..54319845 100644 --- a/.github/workflows/docker-crawlab.yml +++ b/.github/workflows/docker-crawlab.yml @@ -311,11 +311,6 @@ jobs: env: CRAWLAB_NODE_MASTER: N CRAWLAB_MASTER_HOST: master - options: >- - --health-cmd "curl -f http://localhost:8000/health || exit 1" - --health-interval 10s - --health-timeout 5s - --health-retries 10 steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/core/task/handler/service.go b/core/task/handler/service.go index 51fe5df2..6ccb263e 100644 --- a/core/task/handler/service.go +++ b/core/task/handler/service.go @@ -85,8 +85,8 @@ func (svc *Service) fetchAndRunTasks() { continue } - // validate if there are available runners - if svc.getRunnerCount() >= n.MaxRunners { + // validate if max runners is reached (max runners = 0 means no limit) + if n.MaxRunners > 0 && svc.getRunnerCount() >= n.MaxRunners { continue } diff --git a/core/utils/config.go b/core/utils/config.go index 3f1b0268..54457bce 100644 --- a/core/utils/config.go +++ b/core/utils/config.go @@ -24,7 +24,7 @@ const ( DefaultApiAllowCredentials = "true" DefaultApiAllowMethods = "DELETE, POST, OPTIONS, GET, PUT" DefaultApiAllowHeaders = "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With" - DefaultNodeMaxRunners = 16 + DefaultNodeMaxRunners = 0 // 0 means no limit MetadataConfigDirName = ".crawlab" MetadataConfigName = "config.json" PyenvRoot = "/root/.pyenv"