-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vdk-server: status returns if server is not running (#754)
When running `vdk server --status` command it was returning that the control service was installed but it was not running (the process was down). So added a check to explicitly verify that. Added a few more debug messages. Testing Done: vdk server -s locally and verified message. Signed-off-by: Antoni Ivanov <aivanov@vmware.com>
- Loading branch information
1 parent
1b4e66f
commit 2f598d2
Showing
2 changed files
with
121 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
projects/vdk-plugins/vdk-server/src/vdk/plugin/server/server_plugin_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2021 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import requests | ||
from requests.adapters import HTTPAdapter | ||
from requests.packages.urllib3.util.retry import Retry | ||
|
||
|
||
def requests_retry_session( | ||
retries=3, | ||
backoff_factor=0.3, | ||
status_forcelist=(500, 502, 503, 504), | ||
session=None, | ||
) -> requests.Session: | ||
session = session or requests.Session() | ||
retry = Retry( | ||
total=retries, | ||
read=retries, | ||
connect=retries, | ||
backoff_factor=backoff_factor, | ||
status_forcelist=status_forcelist, | ||
) | ||
adapter = HTTPAdapter(max_retries=retry) | ||
session.mount("http://", adapter) | ||
session.mount("https://", adapter) | ||
return session |