Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Dec 10, 2024
1 parent eecc604 commit 6058a06
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
6 changes: 3 additions & 3 deletions containers/ecr-viewer/seed-scripts/docker-compose-load.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
services:
# The Locust engine is used for load testing purposes.
# The Locust engine is used for load testing purposes.
locust-brain:
image: locustio/locust
ports:
- "8089:8089"
- "8089:8089"
volumes:
- ./locustfile.py:/home/locust/locustfile.py
- ./requirements.txt:/home/locust/requirements.txt
Expand All @@ -29,4 +29,4 @@ services:
- ./locustfile.py:/home/locust/locustfile.py
- ./requirements.txt:/home/locust/requirements.txt
- ./baseECR/LA:/home/locust/baseECR/LA
command: -f /home/locust/locustfile.py --worker --master-host locust-brain
command: -f /home/locust/locustfile.py --worker --master-host locust-brain
35 changes: 23 additions & 12 deletions containers/ecr-viewer/seed-scripts/locustfile.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
from locust import HttpUser, task, between
import subprocess
import os
import shutil
import random
import json
import shutil
import subprocess

from locust import between
from locust import HttpUser
from locust import task


class EcrViewer(HttpUser):
wait_time = between(1, 5)

@task
def ecr_viewer(self):

Check failure on line 15 in containers/ecr-viewer/seed-scripts/locustfile.py

View workflow job for this annotation

GitHub Actions / orchestration-python-linting

Ruff (D102)

containers/ecr-viewer/seed-scripts/locustfile.py:15:9: D102 Missing docstring in public method
self.client.get(f"/ecr-viewer")
self.client.get("/ecr-viewer")

@task
def orchestration(self):

Check failure on line 19 in containers/ecr-viewer/seed-scripts/locustfile.py

View workflow job for this annotation

GitHub Actions / orchestration-python-linting

Ruff (D102)

containers/ecr-viewer/seed-scripts/locustfile.py:19:9: D102 Missing docstring in public method
self.client.get(f"/orchestration")
self.client.get("/orchestration")

@task
def upload_zip(self):

Check failure on line 23 in containers/ecr-viewer/seed-scripts/locustfile.py

View workflow job for this annotation

GitHub Actions / orchestration-python-linting

Ruff (D102)

containers/ecr-viewer/seed-scripts/locustfile.py:23:9: D102 Missing docstring in public method
Expand All @@ -27,21 +30,26 @@ def upload_zip(self):
"message_type": "ecr",
}
# print(f"Uploading {file}")
file_tuple = { "upload_file": ( file, opened_file.read(), "application/zip") }
response = self.client.post(f"/orchestration/process-zip", data=data, files=file_tuple)
file_tuple = {
"upload_file": (file, opened_file.read(), "application/zip")
}
response = self.client.post(
"/orchestration/process-zip", data=data, files=file_tuple
)
self.tasks.append(check_ecr(self, file, response.json()))

# Runs at the start of each test. Useful for authentication and setup actions.
def on_start(self):

Check failure on line 42 in containers/ecr-viewer/seed-scripts/locustfile.py

View workflow job for this annotation

GitHub Actions / orchestration-python-linting

Ruff (D102)

containers/ecr-viewer/seed-scripts/locustfile.py:42:9: D102 Missing docstring in public method
subprocess.run(["pip", "install", "-r", "requirements.txt"])
pass


# Check the ecr viewer response for eicr_id and view the ecr
def check_ecr(self, file, response):

Check failure on line 48 in containers/ecr-viewer/seed-scripts/locustfile.py

View workflow job for this annotation

GitHub Actions / orchestration-python-linting

Ruff (D103)

containers/ecr-viewer/seed-scripts/locustfile.py:48:5: D103 Missing docstring in public function
if "detail" in response:
print(f"{file}", response['detail'])
print(f"{file}", response["detail"])
if "message" in response:
print(f"{file}", response['message'])
print(f"{file}", response["message"])
if "processed_values" not in response:
print("No processed_values found in response")
return
Expand All @@ -57,6 +65,7 @@ def check_ecr(self, file, response):
else:
print("No eicr_id found in response")


# Get all the zipped files in the baseECR folder
def get_zipped_files():

Check failure on line 70 in containers/ecr-viewer/seed-scripts/locustfile.py

View workflow job for this annotation

GitHub Actions / orchestration-python-linting

Ruff (D103)

containers/ecr-viewer/seed-scripts/locustfile.py:70:5: D103 Missing docstring in public function
files = []
Expand All @@ -80,7 +89,9 @@ def get_zipped_files():

if os.path.exists(os.path.join(folder_path, "CDA_eICR.xml")):
random_number = random.randint(1, 30)
zipped_file = shutil.make_archive(f"{random_number}", 'zip', folder_path)
zipped_file = shutil.make_archive(
f"{random_number}", "zip", folder_path
)
print(f"Zipped {folder_path} to {zipped_file}")
files.append(zipped_file)
# If neither `bundle.json` nor `CDA_eICR.xml` exists, skip processing
Expand Down

0 comments on commit 6058a06

Please sign in to comment.