-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into slow-dataset-files
- Loading branch information
Showing
43 changed files
with
1,216 additions
and
1,158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
# the iam-token.sh scripts generate new IAM token | ||
# it relies on the following environment variables | ||
# IAM_CLIENT_ID client id value obtained from IAM provider | ||
# IAM_CLIENT_SECRET client secret value obtained from IAM provider | ||
# IAM_TOKEN output file name to store obtained IAM token | ||
# All steps to obtain client credentials can be found: | ||
# https://github.com/dmwm/WMCore/pull/11093#issuecomment-1098131010 | ||
|
||
# check if curl exist on a system | ||
if ! command -v curl &> /dev/null | ||
then | ||
echo "curl could not be found, please install it on your system" | ||
exit | ||
fi | ||
# check if jq exist on a system | ||
if ! command -v jq &> /dev/null | ||
then | ||
echo "jq could not be found, please install it on your system" | ||
exit | ||
fi | ||
|
||
#echo "tools are checked" | ||
|
||
# use either IAM_CLIENT_ID, /etc/secrets/client_id or fail | ||
if [ -n "$IAM_CLIENT_ID" ] && [ -f $IAM_CLIENT_ID ]; then | ||
export client_id=`cat $IAM_CLIENT_ID` | ||
else | ||
echo "unable to locate client_id file, please either setup IAM_CLIENT_ID to point to your client_id file name" | ||
exit | ||
fi | ||
#echo "use client_id=$client_id" | ||
|
||
# use either IAM_CLIENT_SECRET, /etc/secrets/client_secret or fail | ||
if [ -n "$IAM_CLIENT_SECRET" ] && [ -f $IAM_CLIENT_SECRET ]; then | ||
export client_secret=`cat $IAM_CLIENT_SECRET` | ||
else | ||
echo "unable to locate client_secret file, please either setup IAM_CLIENT_secret to point to your client_secret file name" | ||
exit | ||
fi | ||
#echo "use client_secret=$client_secret" | ||
|
||
# obtain new token using client credentials | ||
if [ -n "IAM_TOKEN" ]; then | ||
# grant_type=client_credentials key=value pair is required by IAM provider | ||
# to specify that request contains clients credentials | ||
curl -s -k -d grant_type=client_credentials \ | ||
-u ${client_id}:${client_secret} \ | ||
https://cms-auth.web.cern.ch/token | jq -r '.access_token' > $IAM_TOKEN | ||
echo "New IAM token generated and can be found at $IAM_TOKEN" | ||
else | ||
echo "Please setup IAM_TOKEN environment variable pointing to a file name where token will be written" | ||
exit | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
When to use this script: when a workflow is in status "aborted" but | ||
it still has active GQEs. | ||
Use this script to mimic exactly the same action as the one taken | ||
by ReqMgr2 when aborting a workflow (without a state transition). | ||
This script will mark the global workqueue elements - for a given | ||
workflow - as CancelRequested, such that the agents can proceed | ||
and acknowledge it, moving elements to status Canceled. | ||
""" | ||
from __future__ import print_function | ||
|
||
import os | ||
import sys | ||
|
||
from WMCore.Configuration import loadConfigurationFile | ||
from WMCore.Services.WorkQueue.WorkQueue import WorkQueue | ||
|
||
|
||
def main(): | ||
args = sys.argv[1:] | ||
if not len(args) == 1: | ||
print("usage: kill-workflow-in-global workflowname") | ||
sys.exit(0) | ||
wflowName = args[0] | ||
|
||
# get configuration file path | ||
if "WMAGENT_CONFIG" not in os.environ: | ||
os.environ['WMAGENT_CONFIG'] = '/data/srv/wmagent/current/config/wmagent/config.py' | ||
|
||
# load config | ||
wmConfig = loadConfigurationFile(os.environ['WMAGENT_CONFIG']) | ||
|
||
gqService = WorkQueue(wmConfig.WorkloadSummary.couchurl, | ||
wmConfig.WorkQueueManager.dbname) | ||
|
||
gqService.cancelWorkflow(wflowName) | ||
print("Cancel requested for workflow: {}".format(wflowName)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[pep8] | ||
[pycodestyle] | ||
format=pylint | ||
hang-closing=True | ||
max-line-length = 160 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.