-
Notifications
You must be signed in to change notification settings - Fork 12
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 script to convert kapel output records to Gratia records #183
Merged
Merged
Changes from 7 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b36ee9e
add basic script that attempts to convert APEL records to gratia records
mwestphall e20f218
baseline attempt to send records
mwestphall d9a25d3
consolidate updates into one directory
mwestphall f9263b7
Merge remote-tracking branch 'kapel/feature/output-to-gratia' into me…
mwestphall 46d8fe6
rename tld
mwestphall a5589aa
fix issue with reading the apel summary record
mwestphall de585fd
read from APEL individual job records rather than summary records
mwestphall 28f5795
fix using wrong end time for gratia records
mwestphall 9dae3a3
Add build pipeline for gratia-k8s-probe (SOFTWARE-5835)
brianhlin 36dedf4
Rename Kuberentes probe to align with existing naming schemes
brianhlin 4633ca7
Content changes for name alignment (SOFTWARE-5835)
brianhlin 33a67f7
This is Gratia, not APEL (SOFTWARE-5835)
brianhlin 25bf3e2
Hardcode the reporter, service, and "batch system" (SOFTWARE-5835)
brianhlin 0016d9d
Set the probe version at build time (SOFTWARE-5835)
brianhlin b5c71e8
Merge pull request #1 from brianhlin/SOFTWARE-5835.gratia-kapel
mwestphall a8a87dc
clean up a couple name change issues
mwestphall 62e8cd1
Differentiate k8s probes in the ProbeName (SOFTWARE-5835)
brianhlin f3e59c0
Merge pull request #2 from brianhlin/SOFTWARE-5835.gratia-kapel
mwestphall f24961d
Make several gratia directories rwx-able to allow running the probe a…
mwestphall 1e57861
run as explicit non-root user
mwestphall c62b5f3
include osg version in image tags for gha
mwestphall 036acc9
freeze versions in requirements.txt
mwestphall 55c32c2
print env file contents for debugging
mwestphall 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
name: Build and Push Kubernetes Probe Docker image | ||
|
||
on: | ||
push: | ||
branches: [ 2.x ] | ||
paths: | ||
- '.github/workflows/build-k8s-container.yml' | ||
- 'gratia-output-kapel/**' | ||
- 'common/**' | ||
repository_dispatch: | ||
types: | ||
- dispatch-build | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.repository, 'opensciencegrid/') | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: make date tag | ||
id: mkdatetag | ||
run: echo "dtag=$(date +%Y%m%d-%H%M)" >> $GITHUB_OUTPUT | ||
|
||
- name: make tags | ||
id: mktags | ||
env: | ||
DTAG=${{ steps.mkdatetag.outputs.dtag }} | ||
run: | | ||
reponame="osg-htc/gratia-probe-k8s" | ||
tags=() | ||
for registry in docker.io hub.opensciencegrid.org; do | ||
tags+=("$registry/$reponame:release") | ||
tags+=("$registry/$reponame:release-$DTAG) | ||
done | ||
|
||
IFS=, | ||
echo "image_tags=${tags[*]}" >> $GITHUB_OUTPUT | ||
echo "ts_image=hub.opensciencegrid.org/$reponame:release-$DTAG" | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2.7.0 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2.2.0 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Log in to OSG Harbor | ||
uses: docker/login-action@v2.2.0 | ||
with: | ||
registry: hub.opensciencegrid.org | ||
username: ${{ secrets.OSG_HARBOR_ROBOT_USER }} | ||
password: ${{ secrets.OSG_HARBOR_ROBOT_PASSWORD }} | ||
|
||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: osg-pilot-container/Dockerfile | ||
push: true | ||
build-args: | | ||
TIMESTAMP_IMAGE=${{ steps.mktags.outputs.ts_image }} | ||
tags: "${{ steps.mktags.outputs.image_tags }}" |
This file was deleted.
Oops, something went wrong.
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,14 +1,17 @@ | ||
FROM almalinux:9 | ||
|
||
ARG TIMESTAMP_IMAGE=gratia-probe-k8s:release-$(date +%Y%m%d-%H%M) | ||
ENV GRATIA_PROBE_VERSION=$TIMESTAMP_IMAGE | ||
|
||
# Install EPEL, the OSG software base repo, and gratia-probe-common | ||
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \ | ||
yum install -y https://repo.opensciencegrid.org/osg/23-main/osg-23-main-el9-release-latest.rpm && \ | ||
yum install -y gratia-probe-common python3-pip | ||
|
||
WORKDIR /etc/kapel-gratia-output | ||
COPY requirements.txt /etc/kapel-gratia-output/ | ||
WORKDIR /gratia | ||
COPY requirements.txt /gratia | ||
RUN pip install -r requirements.txt | ||
COPY gratia-config /etc/kapel-gratia-output/gratia-config | ||
COPY *.py /etc/kapel-gratia-output/ | ||
COPY ProbeConfig /etc/gratia/kubernetes | ||
COPY *.py /gratia | ||
|
||
CMD python3 gratia_output.py | ||
CMD python3 kubernetes_meter.py |
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
File renamed without changes.
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,7 +1,7 @@ | ||
import argparse | ||
import datetime | ||
|
||
from gratia_output_config import GratiaOutputConfig | ||
from gratia_output_config import GratiaK8sConfig | ||
from dirq.QueueSimple import QueueSimple | ||
import os | ||
from datetime import datetime, timezone | ||
|
@@ -113,7 +113,7 @@ def send_gratia_records(records: list[ApelRecordConverter]): | |
|
||
|
||
|
||
def setup_gratia(config: GratiaOutputConfig): | ||
def setup_gratia(config: GratiaK8sConfig): | ||
|
||
if not config.gratia_config_path or not os.path.exists(config.gratia_config_path): | ||
raise Exception("No valid gratia config path given") | ||
|
@@ -123,9 +123,9 @@ def setup_gratia(config: GratiaOutputConfig): | |
GratiaWrapper.ExclusiveLock() | ||
|
||
# Register gratia | ||
GratiaCore.RegisterReporter(config.gratia_reporter) | ||
GratiaCore.RegisterService(config.gratia_service, config.gratia_probe_version) | ||
GratiaCore.setProbeBatchManager(config.gratia_probe_manager) | ||
GratiaCore.RegisterReporter("kubernetes_meter") | ||
GratiaCore.RegisterService("Kubernetes", config.gratia_probe_version) | ||
GratiaCore.setProbeBatchManager("kubernetes") | ||
|
||
GratiaCore.Initialize(config.gratia_config_path) | ||
|
||
|
@@ -143,7 +143,7 @@ def batch_dirq(queue, batch_size): | |
|
||
def main(envFile: str): | ||
print(f'Starting Gratia post-processor: {__file__} with envFile {envFile} at {datetime.now(tz=timezone.utc).isoformat()}') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also dump the contents of the env file? It could be helpful for debugging. |
||
cfg = GratiaOutputConfig(envFile) | ||
cfg = GratiaK8sConfig(envFile) | ||
|
||
setup_gratia(cfg) | ||
|
||
|
File renamed without changes.
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,7 @@ | ||
NAMESPACE=OSG | ||
SITE_NAME=OSG | ||
SUBMIT_HOST=OSG | ||
BENCHMARK_VALUE=5 | ||
VO_NAME=OSG | ||
|
||
GRATIA_CONFIG_PATH=/etc/gratia/kubernetes/ProbeConfig |
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.
Since we pull things out of OSG 23, we should probably align tags, e.g.
23-release