-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add galaxy job radar visualization tool stats collection role and scripts #1395
Open
sanjaysrikakulam
wants to merge
6
commits into
usegalaxy-eu:master
Choose a base branch
from
sanjaysrikakulam:galaxy_job_radar
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+104
−1
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
575acbd
add galaxy job radar visualization tool stats collection role and scr…
sanjaysrikakulam e3ae9e7
add longest running jobs stats collection script
sanjaysrikakulam 3727afb
add the role to the maintenance playbook to deploy the scripts
sanjaysrikakulam f4b27d5
Update meta file and add author info
sanjaysrikakulam 34c2721
Merge branch 'master' into galaxy_job_radar
sanjaysrikakulam ecd41f8
Merge branch 'master' into galaxy_job_radar
sanjaysrikakulam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 2 additions & 0 deletions
2
roles/usegalaxy-eu.job-radar-stats-influxdb/defaults/main.yml
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,2 @@ | ||
--- | ||
# defaults file for galaxy-job-radar |
4 changes: 4 additions & 0 deletions
4
roles/usegalaxy-eu.job-radar-stats-influxdb/files/galaxy_failed_jobs_by_destination.sh
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,4 @@ | ||
#!/bin/bash | ||
# Description: This script uses gxadmin to get the errored jobs from the Galaxy server in the last 1 hour and outputs the count of errored jobs by destination in InfluxDB line protocol format. | ||
|
||
gxadmin tsvquery errored-jobs 1 | awk '{count[$7]++} END {for (dest in count) printf "errored_jobs_by_destination,destination_id=%s,state=errored count=%d\n", dest, count[dest]}' |
4 changes: 4 additions & 0 deletions
4
...usegalaxy-eu.job-radar-stats-influxdb/files/galaxy_longest_running_jobs_by_destination.sh
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,4 @@ | ||
#!/bin/bash | ||
# Description: This script uses gxadmin to get the longest running jobs on the Galaxy server and outputs the longest running jobs by destination in InfluxDB line protocol format. | ||
|
||
gxadmin query q "COPY (SELECT j.id, j.tool_id, j.destination_id, EXTRACT(EPOCH FROM (NOW() - jsh.running_since)) / 3600 AS hours_since_running FROM job j JOIN LATERAL (SELECT MIN(create_time) AS running_since FROM job_state_history jsh WHERE jsh.job_id = j.id AND jsh.state = 'running') jsh ON true WHERE j.state = 'running' ORDER BY hours_since_running DESC) TO STDOUT WITH (FORMAT CSV, HEADER FALSE, DELIMITER ',');" | awk -F, '{printf "longest_running_jobs,job_id=%s,tool_id=%s,destination_id=%s hours_since_running=%d\n", $1, $2, $3, $4}' |
4 changes: 4 additions & 0 deletions
4
roles/usegalaxy-eu.job-radar-stats-influxdb/files/galaxy_most_used_tools_by_destination.sh
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,4 @@ | ||
#!/bin/bash | ||
# Description: This script uses gxadmin to count the most used tools on the Galaxy server and outputs the count of most used tools by destination in InfluxDB line protocol format. | ||
|
||
gxadmin query q "COPY (SELECT regexp_replace(tool_id, '/[^/]+$', '') AS tool_id_no_version, destination_id, COUNT(*) AS job_count FROM job WHERE create_time >= (now() AT TIME ZONE 'UTC' - INTERVAL '1 hours') AND tool_id ILIKE 'toolshed%' AND destination_id IS NOT NULL GROUP BY tool_id_no_version, destination_id ORDER BY job_count DESC) TO STDOUT WITH (FORMAT CSV, HEADER FALSE, DELIMITER ',');" | awk -F, '{printf "most_used_tools_by_destination,tool_id=%s,destination_id=%s job_count=%d\n", $1, $2, $3}' |
4 changes: 4 additions & 0 deletions
4
...s/usegalaxy-eu.job-radar-stats-influxdb/files/galaxy_num_anonymous_jobs_by_destination.sh
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,4 @@ | ||
#!/bin/bash | ||
# Description: This script uses gxadmin to count the number of jobs run by anonymous users on the Galaxy server and outputs the count of anonymous users by destination in InfluxDB line protocol format. | ||
|
||
gxadmin csvquery queue-detail | awk -F',' '/Anonymous User/ {count[$9]++} END {for (id in count) print "anonymous_user_jobs_by_destination,destination_id=" id ", count=" count[id]}' |
4 changes: 4 additions & 0 deletions
4
...egalaxy-eu.job-radar-stats-influxdb/files/galaxy_unique_users_job_count_by_destination.sh
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,4 @@ | ||
#!/bin/bash | ||
# Description: This script uses gxadmin to count the unique users running jobs on the Galaxy server and outputs the count of unique users by destination in InfluxDB line protocol format. | ||
|
||
gxadmin csvquery queue-detail | grep running | awk -F, '{users[$9][$5]=1} END {for (dest in users) {count=0; for (user in users[dest]) count++; printf "num_unique_users_jobs_by_destination,destination_id=%s,state=running unique_user_count=%d\n", dest, count}}' |
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 @@ | ||
galaxy_info: | ||
author: Sanjay Srikakulam | ||
description: Galaxy stats collection scripts for galaxy job radar visualization tool | ||
company: University of Freiburg | ||
|
||
# If the issue tracker for your role is not on github, uncomment the | ||
# next line and provide a value | ||
# issue_tracker_url: http://example.com/issue/tracker | ||
|
||
# Choose a valid license ID from https://spdx.org - some suggested licenses: | ||
# - BSD-3-Clause (default) | ||
# - MIT | ||
# - GPL-2.0-or-later | ||
# - GPL-3.0-only | ||
# - Apache-2.0 | ||
# - CC-BY-4.0 | ||
license: license (GPL-2.0-or-later, MIT, etc) | ||
|
||
min_ansible_version: 2.1 | ||
|
||
# If this a Container Enabled role, provide the minimum Ansible Container version. | ||
# min_ansible_container_version: | ||
|
||
# | ||
# Provide a list of supported platforms, and for each platform a list of versions. | ||
# If you don't wish to enumerate all versions for a particular platform, use 'all'. | ||
# To view available platforms and versions (or releases), visit: | ||
# https://galaxy.ansible.com/api/v1/platforms/ | ||
# | ||
# platforms: | ||
# - name: Fedora | ||
# versions: | ||
# - all | ||
# - 25 | ||
# - name: SomePlatform | ||
# versions: | ||
# - all | ||
# - 1.0 | ||
# - 7 | ||
# - 99.99 | ||
|
||
galaxy_tags: | ||
[] | ||
# List tags for your role here, one per line. A tag is a keyword that describes | ||
# and categorizes the role. Users find roles by searching for tags. Be sure to | ||
# remove the '[]' above, if you add tags to this list. | ||
# | ||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters. | ||
# Maximum 20 tags per role. | ||
|
||
dependencies: | ||
[] | ||
# List your role dependencies here, one per line. Be sure to remove the '[]' above, | ||
# if you add dependencies to this list. |
14 changes: 14 additions & 0 deletions
14
roles/usegalaxy-eu.job-radar-stats-influxdb/tasks/main.yml
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,14 @@ | ||
--- | ||
- name: Copy the gxadmin bash scripts for collecting stats for galaxy job radar visualization tool | ||
ansible.builtin.copy: | ||
src: '{{ item }}' | ||
dest: 'usr/bin/{{ item }}' | ||
owner: 'root' | ||
group: 'root' | ||
mode: 0755 | ||
loop: | ||
- 'galaxy_failed_jobs_by_destination.sh' | ||
- 'galaxy_most_used_tools_by_destination.sh' | ||
- 'galaxy_num_anonymous_jobs_by_destination.sh' | ||
- 'galaxy_unique_users_job_count_by_destination.sh' | ||
- 'galaxy_longest_running_jobs_by_destination.sh' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those queries are very expensive arn't they? Do we really need to run them this often?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, The SQL queries I have added are optimized as much as possible (I think when I timed their executions, they completed in less than a few seconds (Yes, a few seconds might be an expensive operation)). The interval depends on how often we want the data in the Galaxy Job Radar to be updated for visualization and how "real" the "real-time" data should be for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stefan and me have the suspicion that one of our many queries for Grafana is causing our DB problems.
I'm just afraid of we add more of those. Please merge this in and observe how it is going, but my maybe we should also:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like dumping the data into the influx tables and then processing it there. Let me see the possibilities.