Skip to content

Commit

Permalink
Merge pull request #413 from vishnoianil/update-worker
Browse files Browse the repository at this point in the history
Update the worker node to user new precheck endpoint with a give apikey
  • Loading branch information
nerdalert authored Sep 11, 2024
2 parents 4c97247 + 082d605 commit d7b21da
Show file tree
Hide file tree
Showing 7 changed files with 874 additions and 597 deletions.
2 changes: 1 addition & 1 deletion deploy/ansible/gobot/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
ILBOT_HTTP_ADDRESS: "127.0.0.1" # Bot's local http server ip address
ILBOT_HTTP_PORT: "8081" # Bot's local http server port
# List of teams that are allowed to run bot commands on the PR
ILBOT_MAINTAINERS: "taxonomy-triagers,taxonomy-approvers,taxonomy-maintainers,instruct-lab-bot-triagers,instruct-lab-bot-maintainers,oversight-committee"
ILBOT_MAINTAINERS: "taxonomy-triagers,taxonomy-approvers,taxonomy-maintainers,instructlab-bot-triagers,instructlab-bot-maintainers,oversight-committee"
ILBOT_REQUIRED_LABELS: "skill,knowledge" # Labels required on each PR to run any bot command.
1,117 changes: 560 additions & 557 deletions deploy/ansible/secrets.enc

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions deploy/ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ private_key: |

# taxonomy_repo: https://instructlab-bot:{{ github_token }}@github.com/instructlab/taxonomy.git
# bot_repo: https://instructlab-bot:{{ github_token }}@github.com/instructlab/instructlab-bot.git
ilab_config_file: /home/fedora/.config/instructlab/config.yml
endpoint_url:
endpoint_api_key:
sdg_endpoint_url:

tls_client_cert: |
Expand Down
9 changes: 8 additions & 1 deletion deploy/ansible/worker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

- name: Set default args for install-worker
ansible.builtin.set_fact:
worker_args: "--gpu-type cuda --github-token {{ github_token }} \
worker_args: "--github-token {{ github_token }} \
--redis-ip {{ redis_ip }} \
--nexodus-reg-key {{ nexodus_reg_key }} \
--aws-access-key-id {{ aws_access_key_id }} \
Expand All @@ -45,6 +45,13 @@
bot_repo != None and
bot_repo | trim != ''

- name: Append ilab config file path
ansible.builtin.set_fact:
worker_args: "{{ worker_args }} --ilab-config-file {{ ilab_config_file }}"
when: ilab_config_file is defined and
ilab_config_file != None and
ilab_config_file | trim != ''

- name: Append args for precheck_endpoint_url
ansible.builtin.set_fact:
worker_args: "{{ worker_args }} --precheck-endpoint-url {{ precheck_endpoint_url }}"
Expand Down
36 changes: 29 additions & 7 deletions scripts/install-worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ OS=""
REDIS_IP=${REDIS_IP:-"127.0.0.1"}
WORK_DIR=${WORK_DIR:-"${HOME}/instructlab-bot"}

ILAB_CONFIG_FILE=${ILAB_CONFIG_FILE:-"./config.yaml"}
PRECHECK_ENDPOINT_URL=${PRECHECK_ENDPOINT_URL:-"http://localhost:8000/v1"}
PRECHECK_API_KEY=${PRECHECK_API_KEY:-""}
SDG_ENDPOINT_URL=${SDG_ENDPOINT_URL:-""}
TLS_INSECURE=${TLS_INSECURE:-"false"}

Expand Down Expand Up @@ -56,7 +58,9 @@ usage() {
echo " --nexodus-reg-key REG_KEY: Optionally a registration key for Nexodus. Ex: https://try.nexodus.io#..."
echo " --redis-ip IP: Optionally the IP address of the Redis server. Default: ${REDIS_IP}"
echo " --work-dir DIR: Optionally the directory to use for the worker. Default: ${WORK_DIR}"
echo " --ilab-config-file FILE: File path of the InstructLab config file. Default: ./config.yaml"
echo " --precheck-endpoint-url URL: The endpoint URL for the ilab precheck. Default: http://localhost:8000/v1"
echo " --precheck-api-key KEY: The API key for the ilab precheck endpoint"
echo " --sdg-endpoint-url URL: The endpoint URL for the ilab sdg-svc. Default: "
echo " --tls-insecure BOOL: Use insecure TLS connection. Default: ${TLS_INSECURE}"
echo " --tls-client-key KEY: The TLS client key for ilab sdg-svc"
Expand Down Expand Up @@ -112,9 +116,9 @@ install_prereqs_fedora() {
go \
make \
nvtop \
python3 \
python3.11 \
python3.11-devel \
python3-pip \
python3-virtualenv \
redis \
unzip \
vim
Expand Down Expand Up @@ -238,13 +242,13 @@ EOF
install_lab() {
cd "${WORK_DIR}" || (echo "Failed to change to work directory: ${WORK_DIR}" && exit 1)
# Always attempt to install instructlab to make sure bot is running the latest version of stable branch.

sudo pip install --upgrade --force-reinstall "git+https://github.com/instructlab/instructlab.git@stable"
# I think we don't need support for the local training for the instructlab bot, because it's pointing to the endpoints.
if [ "${GPU_TYPE}" = "cuda" ]; then
CMAKE_ARGS="-DLLAMA_CUBLAS=on" python3 -m pip install --force-reinstall --no-cache-dir llama-cpp-python
pip3.11 cache remove llama_cpp_python
pip3.11 install 'instructlab[cuda]' -C cmake.args="-DLLAMA_CUDA=on" -C cmake.args="-DLLAMA_NATIVE=off"
pip3.11 install vllm@git+https://github.com/opendatahub-io/[email protected]
elif [ -n "${GPU_TYPE}" ]; then
echo "Unsupported GPU_TYPE: ${GPU_TYPE}"
exit 1
pip3.11 install instructlab
fi
if [ ! -f config.yaml ]; then
ilab init --non-interactive
Expand Down Expand Up @@ -274,11 +278,21 @@ AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
EOF
sudo install -m 0600 labbotworker.sysconfig /etc/sysconfig/labbotworker

# Check if ILAB_CONFIG_FILE is set
if [ -n "${ILAB_CONFIG_FILE}" ]; then
EXTRA_ARGS="${EXTRA_ARGS} --ilab-config-file ${ILAB_CONFIG_FILE}"
fi

# Check if PRECHECK_ENDPOINT_URL is set
if [ -n "${PRECHECK_ENDPOINT_URL}" ]; then
EXTRA_ARGS="${EXTRA_ARGS} --precheck-endpoint-url ${PRECHECK_ENDPOINT_URL}"
fi

# Check if PRECHECK_API_KEY is set
if [ -n "${PRECHECK_API_KEY}" ]; then
EXTRA_ARGS="${EXTRA_ARGS} --precheck-api-key ${PRECHECK_API_KEY}"
fi

# Check if SDG_ENDPOINT_URL is set
if [ -n "${SDG_ENDPOINT_URL}" ]; then
EXTRA_ARGS="${EXTRA_ARGS} --sdg-endpoint-url ${SDG_ENDPOINT_URL} "
Expand Down Expand Up @@ -391,10 +405,18 @@ while [ $# -gt 0 ]; do
WORK_DIR="$2"
shift
;;
--ilab-config-file)
ILAB_CONFIG_FILE="$2"
shift
;;
--precheck-endpoint-url)
PRECHECK_ENDPOINT_URL="$2"
shift
;;
--precheck-api-key)
PRECHECK_API_KEY="$2"
shift
;;
--sdg-endpoint-url)
SDG_ENDPOINT_URL="$2"
shift
Expand Down
Loading

0 comments on commit d7b21da

Please sign in to comment.