mirror of
https://github.com/netinvent/npbackup.git
synced 2025-02-24 22:44:04 +08:00
Reformat files with black
This commit is contained in:
parent
f806d571d4
commit
0bd9510303
2 changed files with 13 additions and 8 deletions
|
@ -29,7 +29,9 @@ from npbackup import configuration
|
|||
logger = logging.getLogger(__intname__)
|
||||
|
||||
|
||||
def metric_writer(config_dict: dict, restic_result: bool, result_string: str, dry_run: bool):
|
||||
def metric_writer(
|
||||
config_dict: dict, restic_result: bool, result_string: str, dry_run: bool
|
||||
):
|
||||
try:
|
||||
labels = {}
|
||||
if config_dict["prometheus"]["metrics"]:
|
||||
|
@ -111,7 +113,9 @@ def metric_writer(config_dict: dict, restic_result: bool, result_string: str, dr
|
|||
logger.info("No metrics authentication present.")
|
||||
authentication = None
|
||||
if not dry_run:
|
||||
upload_metrics(destination, authentication, no_cert_verify, metrics)
|
||||
upload_metrics(
|
||||
destination, authentication, no_cert_verify, metrics
|
||||
)
|
||||
else:
|
||||
logger.info("Not uploading metrics in dry run mode")
|
||||
else:
|
||||
|
@ -612,7 +616,9 @@ class NPBackupRunner:
|
|||
additional_parameters=additional_parameters,
|
||||
)
|
||||
logger.debug("Restic output:\n{}".format(result_string))
|
||||
metric_writer(self.config_dict, result, result_string, self.restic_runner.dry_run)
|
||||
metric_writer(
|
||||
self.config_dict, result, result_string, self.restic_runner.dry_run
|
||||
)
|
||||
|
||||
if post_exec_command:
|
||||
exit_code, output = command_runner(
|
||||
|
|
|
@ -108,16 +108,16 @@ class ResticRunner:
|
|||
os.environ[env_variable] = value
|
||||
|
||||
# Configure default cpu usage when not specifically set
|
||||
if not 'GOMAXPROCS' in self.environment_variables:
|
||||
if not "GOMAXPROCS" in self.environment_variables:
|
||||
nb_cores = os.cpu_count()
|
||||
if nb_cores < 2 :
|
||||
if nb_cores < 2:
|
||||
gomaxprocs = nb_cores
|
||||
elif 2 <= nb_cores <= 4:
|
||||
gomaxprocs = nb_cores - 1
|
||||
elif nb_cores > 4:
|
||||
gomaxprocs = nb_cores - 2
|
||||
logger.debug("Setting GOMAXPROCS to {}".format(gomaxprocs))
|
||||
os.environ['GOMAXPROCS'] = str(gomaxprocs)
|
||||
os.environ["GOMAXPROCS"] = str(gomaxprocs)
|
||||
|
||||
def _remove_env(self) -> None:
|
||||
"""
|
||||
|
@ -342,7 +342,7 @@ class ResticRunner:
|
|||
if value > 0:
|
||||
self._backend_connections = value
|
||||
elif value == 0:
|
||||
if self._backend_type == 'local':
|
||||
if self._backend_type == "local":
|
||||
self._backend_connections = 2
|
||||
else:
|
||||
self._backend_connections = 8
|
||||
|
@ -350,7 +350,6 @@ class ResticRunner:
|
|||
except TypeError:
|
||||
logger.warning("Bogus backend_connections value given.")
|
||||
|
||||
|
||||
@property
|
||||
def additional_parameters(self):
|
||||
return self._addition_parameters
|
||||
|
|
Loading…
Reference in a new issue