How to customize the configuration#

The CLI tool can create and update the global configuration file, which is stored at ~/.config/covalent/covalent.conf or $COVALENT_CONFIG_DIR/covalent.conf if the corresponding variable is defined in the user environment:

$ covalent start --port 45232
Covalent server has started at http://localhost:45232
$ cat ~/.config/covalent/covalent.conf
[sdk]
logs = "/home/user/.cache/covalent"
log_level = "warning"
enable_logging = "false"

[dispatcher]
address = "localhost"
port = 45232
cache = "/home/user/.cache/covalent"
results_dir = "/home/user/covalent"
logs_dir = "/home/user/.config/covalent"
db_path = "/home/user/.local/share/covalent/dispatcher_db.sqlite"

[user_interface]
address = "localhost"
port = 45232
logs = "/home/user/.config/covalent"

[credentials]
dispatcher_api_key = ""
scheduler_api_key = ""
quantum_credentials = ""

[executors.local]
class = "LocalExecutor"
log_stdout = "/tmp/covalent/stdout.log"
log_stderr = "/tmp/covalent/stderr.log"

The configuration may also be accessed as a Python dict:

[ ]:
import covalent as ct
ct.get_config()
{'sdk': {'log_dir': '/var/home/user/.cache/covalent',
  'log_level': 'warning',
  'enable_logging': 'false',
  'executor_dir': '/var/home/user/.config/covalent/executor_plugins'},
 'dispatcher': {'address': 'localhost',
  'port': 45232,
  'cache_dir': '/var/home/user/.cache/covalent',
  'results_dir': 'results',
  'log_dir': '/var/home/user/.cache/covalent'},
 'user_interface': {'address': 'localhost',
  'port': 45232,
  'log_dir': '/var/home/user/.cache/covalent'},
 'executors': {'local': {'log_stdout': 'stdout.log',
   'log_stderr': 'stderr.log',
   'cache_dir': '/tmp/covalent'}}}

or queried using the following formats:

[2]:
ct.get_config("dispatcher.address")
[2]:
'localhost'
[3]:
ct.get_config(["dispatcher.address", "dispatcher.port"])
[3]:
{'dispatcher.address': 'localhost', 'dispatcher.port': 48008}

Values may be set in a similar way:

[4]:
ct.set_config("sdk.enable_logging", "true")
[5]:
ct.set_config({
    "sdk.enable_logging": "true",
    "sdk.log_level": "debug"
})

If the config file is edited directly, it can also be reloaded into a Python environment using

[6]:
ct.reload_config()

The values in the configuration file describe the defaults used by Covalent. Certain settings can also be overridden in other ways. If the config file is deleted, some default settings can be overridden by environment variables:

# Override "sdk.logs"
export COVALENT_LOGDIR="/var/log"
# Override "sdk.enable_logging"
export COVALENT_LOG_TO_FILE=TRUE

Reloading the library will generate a config file reflecting the new default parameters:

$ covalent restart
Covalent server has stopped.
Covalent server has started at http://localhost:45232

$ cat ~/.config/covalent/covalent.conf
[sdk]
log_dir = "/var/log"
log_level = "warning"
enable_logging = "true"

[dispatcher]
address = "localhost"
port = 45232
cache_dir = "/home/user/.cache/covalent"
results_dir = "/home/user/covalent"
log_dir = "/home/user/.cache/covalent"
db_path = "/home/user/.local/share/covalent/dispatcher_db.sqlite"

[user_interface]
address = "localhost"
port = 45232
log_dir = "/home/user/.cache/covalent"

[credentials]
dispatcher_api_key = ""
scheduler_api_key = ""
quantum_credentials = ""

[executors.local]
class = "LocalExecutor"
log_stdout = "stdout.log"
log_stderr = "stderr.log"