-
Notifications
You must be signed in to change notification settings - Fork 11
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
Changes from all commits
c037dcc
d62214b
4a3d431
61a564f
e8cc02f
b2f99ca
7a737fc
f6109aa
67ddbfd
ddb0ef5
5b04de6
827dfb9
1963d35
9650906
dc16079
1bb1de2
f5b5019
202465c
da765da
b3e92a2
21a34f1
8945ef8
27fd27e
bef5639
6fd7ee0
0aa0d8a
110f42b
f3ff5a3
75345cb
bcff419
3351859
3585e50
19984f2
c2b6215
97d443c
e949c77
0b46bfb
0b3aa2b
4a30c75
4cf94bb
71e74b7
009e092
c9924ec
32033a0
5fc3ecc
4747b8c
1d2910b
ba802c2
7e5fc18
e4c13ef
f7f7cb7
ac5a57d
a8280c2
2bf5f8b
d6175a8
ad04c90
b100415
fb2930e
62dcbc7
eab204c
6934d7c
d1b49a8
8722da4
3ce2b1e
3f7a8be
9618ab1
b1f52dc
4dff338
771fdae
c049811
97820fe
c804aa0
e58b343
666605f
5a69838
51d1f32
bba22af
f8e2d4f
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 🐶 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 🐶 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)