Skip to content

Commit 9da1f02

Browse files
author
Justin Merrell
committed
fix: remove extra env vars
1 parent ab2bdae commit 9da1f02

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

docs/serverless-worker.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ To convert a Pod to a Worker, you need to add the following annotations to the P
77
```bash
88
# Development
99
DEBUG= # Set to 'true' to enable debug mode, otherwise leave blank
10-
TEST_LOCAL= # Set to 'true' to test locally, otherwise leave blank
1110

1211
# Configurations
13-
MODEL= # Model to use (Default: stable_diffusion)
1412
EXECUTION_TIMEOUT= # Timeout for execution in milliseconds (Default: 300000)
1513
TERMINATE_IDLE_TIME= # Time in milliseconds to wait before terminating idle pods (Default: 60000)
1614

@@ -78,4 +76,4 @@ To test locally, create the file `test_inputs.json` in the root directory that c
7876
}
7977
```
8078

81-
The inputs should match the inputs your model would expect to see from the API. Then set `TEST_LOCAL` to `true` in the .env file and run the worker.
79+
If the required webhook environment variables are not set, the worker will default to local testing.

runpod/serverless/modules/job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def post(worker_id, job_id, job_output, job_time):
7575
'''
7676
Complete the job.
7777
'''
78-
if os.environ.get('TEST_LOCAL', 'false') == 'true':
78+
if os.environ.get('WEBHOOK_POST_OUTPUT', None) is None:
7979
return
8080

8181
job_data = {

runpod/serverless/modules/lifecycle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def check_worker_ttl_thread(self):
7272
Check worker TTL.
7373
Reduce TTL or timeout by 1 every second.
7474
'''
75-
if os.environ.get('TEST_LOCAL', 'false') != 'true':
75+
if os.environ.get('RUNPOD_API_KEY', None) is not None:
7676
if self.ttl <= 0 or self.work_timeout <= 0:
7777
self.seppuku()
7878

runpod/serverless/modules/upload.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@
2121
}
2222
)
2323

24-
boto_client = bucket_session.client(
25-
's3',
26-
endpoint_url=os.environ.get('BUCKET_ENDPOINT_URL', None),
27-
aws_access_key_id=os.environ.get('BUCKET_ACCESS_KEY_ID', None),
28-
aws_secret_access_key=os.environ.get('BUCKET_SECRET_ACCESS_KEY', None),
29-
config=boto_config
30-
)
24+
if os.environ.get('BUCKET_ENDPOINT_URL', None) is not None:
25+
boto_client = bucket_session.client(
26+
's3',
27+
endpoint_url=os.environ.get('BUCKET_ENDPOINT_URL', None),
28+
aws_access_key_id=os.environ.get('BUCKET_ACCESS_KEY_ID', None),
29+
aws_secret_access_key=os.environ.get('BUCKET_SECRET_ACCESS_KEY', None),
30+
config=boto_config
31+
)
32+
else:
33+
boto_client = None
3134

3235

3336
# ---------------------------------------------------------------------------- #
@@ -37,7 +40,7 @@ def upload_image(job_id, job_results):
3740
'''
3841
Upload image to bucket storage.
3942
'''
40-
if os.environ.get('TEST_LOCAL', 'false') == 'true':
43+
if boto_client is None:
4144
# Save the output to a file
4245
for index, result in enumerate(job_results):
4346
output = BytesIO()

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = runpod
3-
version = 0.1.7
3+
version = 0.1.8
44
description = Official Python library for RunPod API & SDK.
55
long_description = file: README.md
66
long_description_content_type = text/markdown

0 commit comments

Comments
 (0)