Skip to content

Commit

Permalink
Fixes wmagent tagging during run.sh; aesthetic changes (#1499)
Browse files Browse the repository at this point in the history
* Fixes wmagent tagging during run.sh; aesthetic changes

* Alias for setting an agent to drain or out of drain
  • Loading branch information
amaltaro authored Jun 4, 2024
1 parent 50adb39 commit 4f12a66
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 4 additions & 1 deletion docker/pypi/wmagent/etc/wmagent_bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ alias wma_unregister='manage execute-agent wmagent-unregister-wmstats $(hostname
alias wma_stop_component='manage execute-agent wmcoreD --shutdown --component ' # comma separated component names
alias wma_start_component='manage execute-agent wmcoreD --start --component ' # comma separated component names
alias wma_restart_component='manage execute-agent wmcoreD --restart --component ' # comma separated component names
alias wma_resource_control='manage execute-agent wmagent-resource-control -p --site-name ' # + site name

# agent drain check
alias wma_drain='python /usr/local/bin/adhoc-scripts/drainAgent.py'
alias wma_get_drain='python /usr/local/bin/adhoc-scripts/drainAgent.py'
alias wma_set_drain="manage execute-agent wmagent-upload-config '{\"UserDrainMode\":true}'"
alias wma_set_undrain="manage execute-agent wmagent-upload-config '{\"UserDrainMode\":false}'"

# agent tail of all component logs
alias wma_tail_logs='for comp in $(ls $WMA_INSTALL_DIR | grep -v Docker); do echo $comp; tail -n100 $WMA_INSTALL_DIR/$comp/ComponentLog; echo ""; done | less'
Expand Down
3 changes: 2 additions & 1 deletion docker/pypi/wmagent/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ check_databases() {

# Checking CouchDB:
_check_couch
echo "-----------------------------------------------------------------------"
}

set_cronjob() {
Expand Down Expand Up @@ -658,7 +659,7 @@ main(){
echo
echo " b) From the host - by restarting the whole container"
echo " * Kill the currently running container:"
echo " docker kill wmagent"
echo " docker stop wmagent -t 30"
echo " * Start a fresh instance of wmagent:"
echo " ./wmagent-docker-run.sh -t <WMA_TAG> && docker logs -f wmagent"
echo
Expand Down
13 changes: 9 additions & 4 deletions docker/pypi/wmagent/wmagent-docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,17 @@ $tnsMount \
--mount type=bind,source=/etc/sudoers.d,target=/etc/sudoers.d,readonly \
"

registry=local
repository=wmagent
$PULL && {
registry=registry.cern.ch
project=cmsweb
repository=wmagent
echo "Pulling Docker image: registry.cern.ch/cmsweb/wmagent:$WMA_TAG"
docker login registry.cern.ch
docker pull registry.cern.ch/cmsweb/wmagent:$WMA_TAG
docker tag registry.cern.ch/cmsweb/wmagent:$WMA_TAG local/wmagent:$WMA_TAG
docker tag registry.cern.ch/cmsweb/wmagent:$WMA_TAG local/wmagent:latest
docker pull $registry/$project/$repository:$WMA_TAG
docker tag $registry/$project/$repository:$WMA_TAG $registry/$repository:$WMA_TAG
docker tag $registry/$project/$repository:$WMA_TAG $registry/$repository:latest
}

echo "Checking if there is no other wmagent container running and creating a link to the $WMA_VER_RELEASE in the host mount area."
Expand All @@ -126,4 +131,4 @@ echo "Checking if there is no other wmagent container running and creating a lin
ln -s $HOST_MOUNT_DIR/srv/wmagent/$WMA_VER_RELEASE $HOST_MOUNT_DIR/srv/wmagent/current )

echo "Starting wmagent:$WMA_TAG docker container with user: $wmaUser:$wmaGroup"
docker run $dockerOpts local/wmagent:$WMA_TAG
docker run $dockerOpts $registry/$repository:$WMA_TAG

0 comments on commit 4f12a66

Please sign in to comment.