-
Notifications
You must be signed in to change notification settings - Fork 122
Expand file tree
/
Copy pathconstants.py
More file actions
122 lines (103 loc) · 3.59 KB
/
constants.py
File metadata and controls
122 lines (103 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#
# (C) Copyright Cloudlab URV 2020
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
import tempfile
LOGGER_LEVEL = 'info'
LOGGER_STREAM = 'ext://sys.stderr'
LOGGER_FORMAT = "%(asctime)s [%(levelname)s] %(filename)s:%(lineno)s -- %(message)s"
LOGGER_FORMAT_SHORT = "[%(levelname)s] %(filename)s:%(lineno)s -- %(message)s"
LOGGER_LEVEL_CHOICES = ["debug", "info", "warning", "error", "critical"]
CPU_COUNT = os.cpu_count()
STORAGE_CLI_MSG = '{} client created'
COMPUTE_CLI_MSG = '{} client created'
LOCALHOST = 'localhost'
SERVERLESS = 'serverless'
STANDALONE = 'standalone'
MODE_DEFAULT = SERVERLESS
SERVERLESS_BACKEND_DEFAULT = 'aws_lambda'
STANDALONE_BACKEND_DEFAULT = 'aws_ec2'
STORAGE_BACKEND_DEFAULT = 'aws_s3'
JOBS_PREFIX = "lithops.jobs"
TEMP_PREFIX = "lithops.jobs/tmp"
LOGS_PREFIX = "lithops.logs"
RUNTIMES_PREFIX = "lithops.runtimes"
MAX_AGG_DATA_SIZE = 4 # 4MiB
WORKER_PROCESSES_DEFAULT = 1
TEMP_DIR = os.path.realpath(tempfile.gettempdir())
USER_TEMP_DIR = 'lithops-' + os.getenv("USER", "root")
LITHOPS_TEMP_DIR = os.path.join(TEMP_DIR, USER_TEMP_DIR)
JOBS_DIR = os.path.join(LITHOPS_TEMP_DIR, 'jobs')
LOGS_DIR = os.path.join(LITHOPS_TEMP_DIR, 'logs')
MODULES_DIR = os.path.join(LITHOPS_TEMP_DIR, 'modules')
CUSTOM_RUNTIME_DIR = os.path.join(LITHOPS_TEMP_DIR, 'custom-runtime')
RN_LOG_FILE = os.path.join(LITHOPS_TEMP_DIR, 'localhost-runner.log')
SV_LOG_FILE = os.path.join(LITHOPS_TEMP_DIR, 'localhost-service.log')
FN_LOG_FILE = os.path.join(LITHOPS_TEMP_DIR, 'functions.log')
CLEANER_DIR = os.path.join(LITHOPS_TEMP_DIR, 'cleaner')
CLEANER_PID_FILE = os.path.join(CLEANER_DIR, 'cleaner.pid')
CLEANER_LOG_FILE = os.path.join(CLEANER_DIR, 'cleaner.log')
HOME_DIR = os.path.expanduser('~')
CONFIG_DIR = os.path.join(HOME_DIR, '.lithops')
CACHE_DIR = os.path.join(CONFIG_DIR, 'cache')
CONFIG_FILE = os.path.join(CONFIG_DIR, 'config')
CONFIG_FILE_GLOBAL = os.path.join("/etc", "lithops", "config")
LITHOPS_DEFAULT_CONFIG_KEYS = {
'monitoring': 'storage',
'monitoring_interval': 2,
'execution_timeout': 1800
}
SA_INSTALL_DIR = '/opt/lithops'
SA_SETUP_LOG_FILE = f'{SA_INSTALL_DIR}/setup.log'
SA_SETUP_DONE_FILE = f'{SA_INSTALL_DIR}/setup-done.flag'
SA_MASTER_LOG_FILE = f'{LITHOPS_TEMP_DIR}/master-service.log'
SA_WORKER_LOG_FILE = f'{LITHOPS_TEMP_DIR}/worker-service.log'
SA_MASTER_SERVICE_PORT = 8080
SA_WORKER_SERVICE_PORT = 8081
SA_CONFIG_FILE = os.path.join(SA_INSTALL_DIR, 'config')
SA_MASTER_DATA_FILE = os.path.join(SA_INSTALL_DIR, 'master.data')
SA_WORKER_DATA_FILE = os.path.join(SA_INSTALL_DIR, 'worker.data')
SA_DEFAULT_CONFIG_KEYS = {
'runtime': 'python3',
'exec_mode': 'reuse',
'use_gpu': False,
'start_timeout': 300,
'auto_dismantle': True,
'soft_dismantle_timeout': 300,
'hard_dismantle_timeout': 3600
}
SERVERLESS_BACKENDS = [
'ibm_cf',
'code_engine',
'knative',
'openwhisk',
'aws_lambda',
'aws_batch',
'gcp_cloudrun',
'gcp_functions',
'cloudrun',
'azure_functions',
'azure_containers',
'aliyun_fc',
'oracle_f',
'k8s',
'singularity'
]
STANDALONE_BACKENDS = [
'ibm_vpc',
'aws_ec2',
'azure_vms',
'vm'
]