-
Notifications
You must be signed in to change notification settings - Fork 8
enable smooth environment variable naming transition #311
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
base: main
Are you sure you want to change the base?
Changes from all commits
60024b1
6735697
a547500
a0b3e20
657cc53
578c4a3
ac8fcef
6aa89a2
5d33715
1e07a3a
af281ec
01c2fad
f52626b
35845f1
ed673bf
c72520e
9ed52b8
a6070fd
67bf777
ec58731
b47a836
31f25c1
a9101b5
dc7e090
fb7d113
bf8b20c
43c576a
d382165
a80349d
aeb05b5
b340f65
1f89a32
741fba0
de2fc9f
6330627
a023827
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| from .LoginException import LoginException | ||
| from .Environment import Environment | ||
| from .LoginException import LoginException |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| import requests | ||
| from redis.exceptions import ConnectionError as RedisConnectionError | ||
|
|
||
| from collectoss.application.environment import SystemEnv | ||
| from collectoss.tasks.start_tasks import collection_monitor, create_collection_status_records | ||
| from collectoss.tasks.git.facade_tasks import clone_repos | ||
| from collectoss.tasks.github.contributors import process_contributors | ||
|
|
@@ -31,7 +32,7 @@ | |
|
|
||
| from keyman.KeyClient import KeyClient, KeyPublisher | ||
|
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. [pylint] reported by reviewdog 🐶 |
||
|
|
||
| reset_logs = os.getenv("AUGUR_RESET_LOGS", 'True').lower() in ('true', '1', 't', 'y', 'yes') | ||
| reset_logs = SystemEnv.get_bool("AUGUR_RESET_LOGS", True) | ||
|
|
||
| logger = SystemLogger("collectoss", reset_logfiles=reset_logs).get_logger() | ||
|
|
||
|
|
@@ -61,7 +62,7 @@ def start(ctx, disable_collection, development, pidfile, port): | |
| signal.signal(signal.SIGINT, manager.shutdown_signal_handler) | ||
|
|
||
| try: | ||
| if os.environ.get('AUGUR_DOCKER_DEPLOY') != "1": | ||
| if SystemEnv.get('COLLECTOSS_DOCKER_DEPLOY') != "1": | ||
| raise_open_file_limit(100000) | ||
| except Exception as e: | ||
| logger.error( | ||
|
|
@@ -71,10 +72,10 @@ def start(ctx, disable_collection, development, pidfile, port): | |
| raise e | ||
|
|
||
| if development: | ||
| os.environ["AUGUR_DEV"] = "1" | ||
| SystemEnv.set("AUGUR_DEV", "1") | ||
| logger.info("Starting in development mode") | ||
|
|
||
| os.environ["AUGUR_PIDFILE"] = pidfile | ||
| SystemEnv.set("AUGUR_PIDFILE", pidfile) | ||
|
|
||
| try: | ||
| gunicorn_location = os.getcwd() + "/collectoss/api/gunicorn_conf.py" | ||
|
|
@@ -86,10 +87,10 @@ def start(ctx, disable_collection, development, pidfile, port): | |
| if not port: | ||
| port = get_value("Server", "port") | ||
|
|
||
| os.environ["AUGUR_PORT"] = str(port) | ||
| SystemEnv.set("AUGUR_PORT", str(port)) | ||
|
|
||
| if disable_collection: | ||
| os.environ["AUGUR_DISABLE_COLLECTION"] = "1" | ||
| SystemEnv.set("AUGUR_DISABLE_COLLECTION", "1") | ||
|
|
||
| core_worker_count = get_value("Celery", 'core_worker_count') | ||
| secondary_worker_count = get_value("Celery", 'secondary_worker_count') | ||
|
|
@@ -130,7 +131,7 @@ def start(ctx, disable_collection, development, pidfile, port): | |
| processes = start_celery_worker_processes((core_worker_count, secondary_worker_count, facade_worker_count), disable_collection) | ||
|
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. [pylint] reported by reviewdog 🐶 |
||
| manager.processes = processes | ||
|
|
||
| celery_beat_schedule_db = os.getenv("CELERYBEAT_SCHEDULE_DB", "celerybeat-schedule.db") | ||
| celery_beat_schedule_db = SystemEnv.get("CELERYBEAT_SCHEDULE_DB", "celerybeat-schedule.db") | ||
| if os.path.exists(celery_beat_schedule_db): | ||
| logger.info("Deleting old task schedule") | ||
| os.remove(celery_beat_schedule_db) | ||
|
|
@@ -144,7 +145,7 @@ def start(ctx, disable_collection, development, pidfile, port): | |
| manager.keypub = keypub | ||
|
|
||
| if not disable_collection: | ||
| if os.environ.get('AUGUR_DOCKER_DEPLOY') != "1": | ||
| if SystemEnv.get('COLLECTOSS_DOCKER_DEPLOY') != "1": | ||
| orchestrator = subprocess.Popen("python keyman/Orchestrator.py".split()) | ||
|
|
||
| # Wait for orchestrator startup | ||
|
|
@@ -355,10 +356,10 @@ def export_env(config): | |
| Exports your GitHub key and database credentials | ||
| """ | ||
|
|
||
| export_file = open(os.getenv('AUGUR_EXPORT_FILE', 'collectoss_export_env.sh'), 'w+') | ||
| export_file = open(SystemEnv.get('COLLECTOSS_EXPORT_FILE') or 'collectoss_export_env.sh', 'w+') | ||
| export_file.write('#!/bin/bash') | ||
| export_file.write('\n') | ||
| env_file = open(os.getenv('AUGUR_ENV_FILE', 'docker_env.txt'), 'w+') | ||
| env_file = open(SystemEnv.get('COLLECTOSS_ENV_FILE') or 'docker_env.txt', 'w+') | ||
|
|
||
| for env_var in config.get_env_config().items(): | ||
| if "LOG" not in env_var[0]: | ||
|
|
@@ -403,7 +404,7 @@ def get_backend_processes(): | |
| for process in psutil.process_iter(['cmdline', 'name', 'environ']): | ||
| if process.info['cmdline'] is not None and process.info['environ'] is not None: | ||
| try: | ||
| if os.getenv('VIRTUAL_ENV') in process.info['environ']['VIRTUAL_ENV'] and 'python' in ''.join(process.info['cmdline'][:]).lower(): | ||
| if SystemEnv.get('VIRTUAL_ENV') in process.info['environ']['VIRTUAL_ENV'] and 'python' in ''.join(process.info['cmdline'][:]).lower(): | ||
| if process.pid != os.getpid(): | ||
| process_list.append(process) | ||
| except (KeyError, FileNotFoundError): | ||
|
|
||
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.
[pylint] reported by reviewdog 🐶
W0611: Unused ConnectionError imported from redis.exceptions as RedisConnectionError (unused-import)