Skip to content

Commit

Permalink
Permit to add job limit
Browse files Browse the repository at this point in the history
Some worker are not powerfull and need a job limit.

Signed-off-by: Corentin LABBE <[email protected]>
  • Loading branch information
montjoie committed Jan 7, 2025
1 parent fb3a79a commit d4b8e98
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ slaves:
host_healthcheck: If true, enable the optional healthcheck container. See hosting healthchecks below
lava-coordinator: Does the slave should ran a lava-coordinator
expose_ser2net: Do ser2net ports need to be available on host
joblimit: x Add a joblimit to the worker (default 0)
custom_volumes:
- "name:path" Add a custom volume
expose_ports: Expose port p1 on the host to p2 on the worker slave.
Expand Down
3 changes: 3 additions & 0 deletions lava-slave/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ do
lavacli $LAVACLIOPTS workers add --description "LAVA dispatcher on $(cat /root/phyhostname)" $worker || exit $?
# does we ran 2020.09+ and worker need a token
fi

lavacli $LAVACLIOPTS workers update --job-limit $LAVA_JOBLIMIT $worker || exit $?

grep -q "TOKEN" /root/entrypoint.sh
if [ $? -eq 0 ];then
# This is 2020.09+
Expand Down
5 changes: 5 additions & 0 deletions lavalab-gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,13 +549,18 @@ def main():
remote_proto = worker["remote_proto"]
remote_uri = "%s://%s:%s@%s:%s/RPC2" % (remote_proto, remote_user, remote_token, remote_address, remote_rpc_port)
remote_master_url = "%s://%s:%s" % (remote_proto, remote_address, remote_rpc_port)
joblimit = 0

if 'joblimit' in worker:
joblimit = worker['joblimit']

fsetupenv = open("%s/setupenv" % workerdir, "a")
fsetupenv.write("LAVA_MASTER_URI=%s\n" % remote_uri)
fsetupenv.write("LAVA_MASTER_URL=%s\n" % remote_master_url)
fsetupenv.write("LAVA_MASTER_USER=%s\n" % remote_user)
fsetupenv.write("LAVA_MASTER_BASEURI=%s://%s:%s/RPC2\n" % (remote_proto, remote_address, remote_rpc_port))
fsetupenv.write("LAVA_MASTER_TOKEN=%s\n" % remote_token)
fsetupenv.write("LAVA_JOBLIMIT=%d\n" % joblimit)
fsetupenv.close()

if "lava-coordinator" in worker and worker["lava-coordinator"]:
Expand Down

0 comments on commit d4b8e98

Please sign in to comment.