Skip to content

Commit 081f90d

Browse files
committed
update k8s file with new variables + remove files after being uploaded
1 parent 0252e02 commit 081f90d

File tree

5 files changed

+44
-39
lines changed

5 files changed

+44
-39
lines changed

.env

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Environment variables
1+
# Project parameters
2+
PROJECT_NAME="Your_project"
3+
24
# Dataset parameters
3-
DATASET_FORMAT="base"
5+
DATASET_FORMAT="flat"
46
DATASET_VERSION="1"
57
DATASET_UPLOAD="True"
68

@@ -22,7 +24,7 @@ STORAGE_ACCESS_KEY="xxxx"
2224
STORAGE_SECRET_KEY="xxx"
2325

2426
# Integration parameters
25-
INTEGRATION_NAME="roboflow"
27+
INTEGRATION_NAME="s3"
2628

2729
# Roboflow parameters
2830
RBF_API_KEY="xxx"
@@ -35,9 +37,7 @@ S3_ACCESS_KEY="xxx"
3537
S3_SECRET_KEY="xxx"
3638
S3_BUCKET="xxx"
3739

38-
# Feature parameters
39-
PROJECT_NAME="Your_project"
40-
40+
# Logging parameters
4141
TIME_VERBOSE="True"
4242
LOGGING="True"
4343

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ data/output/*
55
utils/__pycache__
66
run.sh
77
data/video
8-
.env.production
8+
.env.production
9+
__pycache__

.vscode/launch.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"program": "${workspaceFolder}/queue_harvesting.py",
1212
"console": "integratedTerminal",
1313
"envFile": "${workspaceFolder}/.env.production",
14-
"python": "${workspaceFolder}/venv/bin/python"
14+
"python": "${workspaceFolder}/.venv/bin/python"
1515
},
1616
{
1717
"name": "Python Debugger: single shot",
@@ -20,7 +20,7 @@
2020
"program": "${workspaceFolder}/single-shot.py",
2121
"console": "integratedTerminal",
2222
"envFile": "${workspaceFolder}/.env.production",
23-
"python": "${workspaceFolder}/venv/bin/python"
23+
"python": "${workspaceFolder}/.venv/bin/python"
2424
}
2525
]
2626
}

integrations/s3/s3_integration.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ def upload_dataset(self, src_project_path):
3939

4040
# Upload the file
4141
self.__upload_file__(source_path, output_path)
42-
print(f'Uploaded: {source_path} to s3://{self.bucket}/{output_path}')
42+
print(
43+
f'Uploaded: {source_path} to s3://{self.bucket}/{output_path}')
44+
45+
# Remove the file after uploading
46+
os.remove(source_path)
4347

4448
def __connect__(self):
4549
"""
@@ -72,9 +76,11 @@ def __upload_file__(self, source_path, output_path):
7276
"""
7377
try:
7478
self.agent.upload_file(source_path, self.bucket, output_path)
75-
print(f"Successfully uploaded '{source_path}' to 's3://{self.bucket}/{output_path}'")
79+
print(
80+
f"Successfully uploaded '{source_path}' to 's3://{self.bucket}/{output_path}'")
7681
except Exception as e:
77-
print(f"Failed to upload '{source_path}' to 's3://{self.bucket}/{output_path}': {e}")
82+
print(
83+
f"Failed to upload '{source_path}' to 's3://{self.bucket}/{output_path}': {e}")
7884

7985
def __check_bucket_exists__(self, bucket_name):
8086
"""
@@ -92,4 +98,5 @@ def __check_bucket_exists__(self, bucket_name):
9298
print(f"Bucket '{bucket_name}' found.")
9399

94100
except:
95-
raise ModuleNotFoundError(f"Bucket '{bucket_name}' does not exist.")
101+
raise ModuleNotFoundError(
102+
f"Bucket '{bucket_name}' does not exist.")

k8s-deployment.yaml

+23-26
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,28 @@ spec:
2020
resources:
2121
limits:
2222
nvidia.com/gpu: 1 # requesting a single GPU
23+
cpu: 2
24+
memory: 2Gi
2325
env:
24-
- name: MODEL_NAME
25-
value: "yolov8n.pt"
26-
- name: MODEL_NAME_2
27-
value: "helmet_dectector_1k_16b_150e.pt"
28-
- name: MODEL_ALLOWED_CLASSES
29-
value: "0"
30-
- name: MODEL_2_ALLOWED_CLASSES
31-
value: "0,1,2"
26+
# Project parameters
27+
- name: PROJECT_NAME
28+
value: "helmet"
3229

30+
# Dataset parameters
3331
- name: DATASET_FORMAT
34-
value: "base"
32+
value: "flat"
3533
- name: DATASET_VERSION
3634
value: "1"
3735
- name: DATASET_UPLOAD
3836
value: "True"
3937

38+
# Forwarding
39+
- name: FORWARDING_MEDIA
40+
value: "False"
41+
- name: REMOVE_AFTER_PROCESSED
42+
value: "False"
43+
44+
# Queue parameters
4045
- name: QUEUE_NAME
4146
value: "data-harvesting" # This is the topic of kafka we will read messages from.
4247
- name: QUEUE_HOST
@@ -47,23 +52,27 @@ spec:
4752
- name: QUEUE_PASSWORD
4853
value: yourpassword
4954

55+
# Kerberos Vault parameters
5056
- name: STORAGE_URI
5157
value: "http://vault-lb.kerberos-vault/api"
5258
- name: STORAGE_ACCESS_KEY
5359
value: "52gyELgxutOXUWhF"
5460
- name: STORAGE_SECRET_KEY
5561
value: "k8DrcB@hQ5XfxDENzDKcnkxBHx"
5662

63+
# Integration parameters
5764
- name: INTEGRATION_NAME
5865
value: "s3"
5966

67+
# Roboflow parameters
6068
- name: RBF_API_KEY
6169
value: "YOUR KEY"
6270
- name: RBF_WORKSPACE
6371
value: "YOUR_WS"
6472
- name: RBF_PROJECT
6573
value: "YOUR_PROJ"
66-
74+
75+
# S3 parameters
6776
- name: S3_ENDPOINT
6877
value: "YOUR_ENDPOINT"
6978
- name: S3_ACCESS_KEY
@@ -73,34 +82,22 @@ spec:
7382
- name: S3_BUCKET
7483
value: "YOUR_BUCKET"
7584

85+
# Logging parameters
7686
- name: LOGGING
7787
value: "True"
78-
- name: PLOT
79-
value: "False"
80-
- name: SAVE_VIDEO
81-
value: "False"
82-
- name: MEDIA_SAVEPATH
83-
value: "/ml/data/input/video.mp4"
84-
- name: OUTPUT_MEDIA_SAVEPATH
85-
value: "/ml/data/input/output_video.mp4"
86-
8788
- name: TIME_VERBOSE
8889
value: "True"
8990

91+
# Classification parameters
9092
- name: CLASSIFICATION_FPS
91-
value: "3"
93+
value: "5"
9294
- name: CLASSIFICATION_THRESHOLD
9395
value: "0.25"
9496
- name: MAX_NUMBER_OF_PREDICTIONS
9597
value: "100"
9698
- name: FRAMES_SKIP_AFTER_DETECT
9799
value: "50"
98-
- name: ALLOWED_CLASSIFICATIONS
99-
value: "0, 1, 2, 3, 5, 7, 14, 15, 16, 24, 26, 28"
100100
- name: MIN_DETECTIONS
101101
value: "1"
102102
- name: IOU
103-
value: "0.85"
104-
105-
- name: REMOVE_AFTER_PROCESSED
106-
value: "True"
103+
value: "0.85"

0 commit comments

Comments
 (0)