Shipyard timeout issue
This PS adds default values for chart values and resolves some issues in python code that utilizes these values: validation_connect_timeout: 20 validation_read_timeout: 300 deckhand_client_connect_timeout: 20 deckhand_client_read_timeout: 300 drydock_client_connect_timeout: 20 drydock_client_read_timeout: 300 Change-Id: Ic5b1920257859239613a3ce77134e6b05bd7e9dd
This commit is contained in:
parent
296853f159
commit
d60987dcc9
|
@ -415,12 +415,12 @@ conf:
|
|||
requests_config:
|
||||
airflow_log_connect_timeout: 5
|
||||
airflow_log_read_timeout: 300
|
||||
deckhand_client_connect_timeout: 5
|
||||
deckhand_client_read_timeout: 300
|
||||
validation_connect_timeout: 5
|
||||
validation_connect_timeout: 20
|
||||
validation_read_timeout: 300
|
||||
notes_connect_timeout: 5
|
||||
notes_read_timeout: 10
|
||||
deckhand_client_connect_timeout: 20
|
||||
deckhand_client_read_timeout: 300
|
||||
drydock_client_connect_timeout: 20
|
||||
drydock_client_read_timeout: 300
|
||||
airflow:
|
||||
|
|
|
@ -376,13 +376,6 @@
|
|||
# Airflow logs retrieval timeout (in seconds) (integer value)
|
||||
#airflow_log_read_timeout = 300
|
||||
|
||||
# Deckhand client connect timeout (in seconds) (integer value)
|
||||
#deckhand_client_connect_timeout = 5
|
||||
|
||||
# Deckhand client timeout (in seconds) for GET, PUT, POST and DELETE request
|
||||
# (integer value)
|
||||
#deckhand_client_read_timeout = 300
|
||||
|
||||
# Airship component validation connect timeout (in seconds) (integer value)
|
||||
#validation_connect_timeout = 5
|
||||
|
||||
|
@ -396,6 +389,13 @@
|
|||
# Read timeout for a note source URL (in seconds) (integer value)
|
||||
#notes_read_timeout = 10
|
||||
|
||||
# Deckhand client connect timeout (in seconds) (integer value)
|
||||
#deckhand_client_connect_timeout = 5
|
||||
|
||||
# Deckhand client timeout (in seconds) for GET, PUT, POST and DELETE request
|
||||
# (integer value)
|
||||
#deckhand_client_read_timeout = 300
|
||||
|
||||
# Connect timeout used for connecting to Drydock using the Drydock client (in
|
||||
# seconds) (integer value)
|
||||
#drydock_client_connect_timeout = 20
|
||||
|
|
|
@ -376,13 +376,6 @@
|
|||
# Airflow logs retrieval timeout (in seconds) (integer value)
|
||||
#airflow_log_read_timeout = 300
|
||||
|
||||
# Deckhand client connect timeout (in seconds) (integer value)
|
||||
#deckhand_client_connect_timeout = 5
|
||||
|
||||
# Deckhand client timeout (in seconds) for GET, PUT, POST and DELETE request
|
||||
# (integer value)
|
||||
#deckhand_client_read_timeout = 300
|
||||
|
||||
# Airship component validation connect timeout (in seconds) (integer value)
|
||||
#validation_connect_timeout = 5
|
||||
|
||||
|
@ -396,6 +389,13 @@
|
|||
# Read timeout for a note source URL (in seconds) (integer value)
|
||||
#notes_read_timeout = 10
|
||||
|
||||
# Deckhand client connect timeout (in seconds) (integer value)
|
||||
#deckhand_client_connect_timeout = 5
|
||||
|
||||
# Deckhand client timeout (in seconds) for GET, PUT, POST and DELETE request
|
||||
# (integer value)
|
||||
#deckhand_client_read_timeout = 300
|
||||
|
||||
# Connect timeout used for connecting to Drydock using the Drydock client (in
|
||||
# seconds) (integer value)
|
||||
#drydock_client_connect_timeout = 20
|
||||
|
|
|
@ -210,19 +210,6 @@ SECTIONS = [
|
|||
default=300,
|
||||
help='Airflow logs retrieval timeout (in seconds)'
|
||||
),
|
||||
cfg.IntOpt(
|
||||
'deckhand_client_connect_timeout',
|
||||
default=5,
|
||||
help='Deckhand client connect timeout (in seconds)'
|
||||
),
|
||||
cfg.IntOpt(
|
||||
'deckhand_client_read_timeout',
|
||||
default=300,
|
||||
help=(
|
||||
'Deckhand client timeout (in seconds) for GET, '
|
||||
'PUT, POST and DELETE request'
|
||||
)
|
||||
),
|
||||
cfg.IntOpt(
|
||||
'validation_connect_timeout',
|
||||
default=5,
|
||||
|
@ -245,6 +232,19 @@ SECTIONS = [
|
|||
default=10,
|
||||
help='Read timeout for a note source URL (in seconds)'
|
||||
),
|
||||
cfg.IntOpt(
|
||||
'deckhand_client_connect_timeout',
|
||||
default=5,
|
||||
help='Deckhand client connect timeout (in seconds)'
|
||||
),
|
||||
cfg.IntOpt(
|
||||
'deckhand_client_read_timeout',
|
||||
default=300,
|
||||
help=(
|
||||
'Deckhand client timeout (in seconds) for GET, '
|
||||
'PUT, POST and DELETE request'
|
||||
)
|
||||
),
|
||||
cfg.IntOpt(
|
||||
'drydock_client_connect_timeout',
|
||||
default=20,
|
||||
|
|
|
@ -72,10 +72,12 @@ class DeckhandBaseOperator(UcpBaseOperator):
|
|||
*args, **kwargs)
|
||||
self.committed_ver = committed_ver
|
||||
self.deckhandclient = deckhandclient
|
||||
self.deckhand_client_connect_timeout = None
|
||||
self.deckhand_client_read_timeout = deckhand_client_read_timeout
|
||||
self.revision_id = revision_id
|
||||
self.svc_session = svc_session
|
||||
self.svc_token = svc_token
|
||||
self.validation_connect_timeout = None
|
||||
self.validation_read_timeout = validation_read_timeout
|
||||
|
||||
@shipyard_service_token
|
||||
|
@ -86,9 +88,12 @@ class DeckhandBaseOperator(UcpBaseOperator):
|
|||
config.read(self.shipyard_conf)
|
||||
|
||||
# Initialize variables
|
||||
self.deckhand_client_connect_timeout = int(config.get(
|
||||
'requests_config', 'deckhand_client_connect_timeout'))
|
||||
self.deckhand_client_read_timeout = int(config.get(
|
||||
'requests_config', 'deckhand_client_read_timeout'))
|
||||
|
||||
self.validation_connect_timeout = int(config.get(
|
||||
'requests_config', 'validation_connect_timeout'))
|
||||
self.validation_read_timeout = int(config.get(
|
||||
'requests_config', 'validation_read_timeout'))
|
||||
|
||||
|
|
|
@ -54,7 +54,8 @@ class DeckhandValidateSiteDesignOperator(DeckhandBaseOperator):
|
|||
retrieved_list = yaml.safe_load(
|
||||
requests.get(validation_endpoint,
|
||||
headers=x_auth_token,
|
||||
timeout=self.validation_read_timeout).text)
|
||||
timeout=(self.validation_connect_timeout,
|
||||
self.validation_read_timeout)).text)
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
raise AirflowException(e)
|
||||
|
|
|
@ -97,6 +97,8 @@ class DrydockBaseOperator(UcpBaseOperator):
|
|||
self.svc_session = svc_session
|
||||
self.svc_token = svc_token
|
||||
self.target_nodes = None
|
||||
self.validation_connect_timeout = None
|
||||
self.validation_read_timeout = None
|
||||
|
||||
def run_base(self, context):
|
||||
"""Base setup/processing for Drydock operators
|
||||
|
@ -113,6 +115,10 @@ class DrydockBaseOperator(UcpBaseOperator):
|
|||
'requests_config', 'drydock_client_connect_timeout'))
|
||||
self.drydock_client_read_timeout = int(config.get(
|
||||
'requests_config', 'drydock_client_read_timeout'))
|
||||
self.validation_connect_timeout = int(config.get(
|
||||
'requests_config', 'validation_connect_timeout'))
|
||||
self.validation_read_timeout = int(config.get(
|
||||
'requests_config', 'validation_read_timeout'))
|
||||
|
||||
# Setup the drydock client
|
||||
self._setup_drydock_client()
|
||||
|
|
|
@ -18,13 +18,14 @@ import requests
|
|||
|
||||
from airflow.plugins_manager import AirflowPlugin
|
||||
from airflow.exceptions import AirflowException
|
||||
from shipyard_airflow.shipyard_const import CustomHeaders
|
||||
|
||||
try:
|
||||
from drydock_base_operator import DrydockBaseOperator
|
||||
except ImportError:
|
||||
from shipyard_airflow.plugins.drydock_base_operator import \
|
||||
DrydockBaseOperator
|
||||
from shipyard_airflow.shipyard_const import CustomHeaders
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -64,10 +65,12 @@ class DrydockValidateDesignOperator(DrydockBaseOperator):
|
|||
LOG.info("Waiting for DryDock to validate site design...")
|
||||
|
||||
try:
|
||||
design_validate_response = requests.post(validation_endpoint,
|
||||
headers=headers,
|
||||
data=json.dumps(payload),
|
||||
timeout=5)
|
||||
design_validate_response = requests.post(
|
||||
validation_endpoint,
|
||||
headers=headers,
|
||||
data=json.dumps(payload),
|
||||
timeout=(self.validation_connect_timeout,
|
||||
self.validation_read_timeout))
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
raise AirflowException(e)
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
# 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 configparser
|
||||
import logging
|
||||
|
||||
from airflow.plugins_manager import AirflowPlugin
|
||||
|
@ -58,6 +59,8 @@ class PromenadeBaseOperator(UcpBaseOperator):
|
|||
*args, **kwargs)
|
||||
self.redeploy_server = redeploy_server
|
||||
self.svc_token = svc_token
|
||||
self.validation_connect_timeout = None
|
||||
self.validation_read_timeout = None
|
||||
|
||||
@shipyard_service_token
|
||||
def run_base(self, context):
|
||||
|
@ -65,6 +68,14 @@ class PromenadeBaseOperator(UcpBaseOperator):
|
|||
# Logs uuid of Shipyard action
|
||||
LOG.info("Executing Shipyard Action %s", self.action_id)
|
||||
|
||||
# Retrieve config values from shipyard configuration.
|
||||
config = configparser.ConfigParser()
|
||||
config.read(self.shipyard_conf)
|
||||
self.validation_connect_timeout = int(config.get(
|
||||
'requests_config', 'validation_connect_timeout'))
|
||||
self.validation_read_timeout = int(config.get(
|
||||
'requests_config', 'validation_read_timeout'))
|
||||
|
||||
# Create additional headers dict to pass context marker
|
||||
# and end user
|
||||
addl_headers = {
|
||||
|
|
|
@ -18,13 +18,14 @@ import requests
|
|||
|
||||
from airflow.exceptions import AirflowException
|
||||
from airflow.plugins_manager import AirflowPlugin
|
||||
from shipyard_airflow.shipyard_const import CustomHeaders
|
||||
|
||||
try:
|
||||
from promenade_base_operator import PromenadeBaseOperator
|
||||
except ImportError:
|
||||
from shipyard_airflow.plugins.promenade_base_operator import \
|
||||
PromenadeBaseOperator
|
||||
from shipyard_airflow.shipyard_const import CustomHeaders
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -64,10 +65,13 @@ class PromenadeValidateSiteDesignOperator(PromenadeBaseOperator):
|
|||
LOG.info("Waiting for Promenade to validate site design...")
|
||||
|
||||
try:
|
||||
design_validate_response = requests.post(validation_endpoint,
|
||||
headers=headers,
|
||||
data=json.dumps(payload),
|
||||
timeout=5)
|
||||
design_validate_response = requests.post(
|
||||
validation_endpoint,
|
||||
headers=headers,
|
||||
data=json.dumps(payload),
|
||||
timeout=(
|
||||
self.validation_connect_timeout,
|
||||
self.validation_read_timeout))
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
raise AirflowException(e)
|
||||
|
|
|
@ -36,10 +36,12 @@ service_type = kubernetesprovisioner
|
|||
[requests_config]
|
||||
airflow_log_connect_timeout = 5
|
||||
airflow_log_read_timeout = 300
|
||||
deckhand_client_connect_timeout = 5
|
||||
deckhand_client_read_timeout = 300
|
||||
validation_connect_timeout = 5
|
||||
validation_connect_timeout = 20
|
||||
validation_read_timeout = 300
|
||||
deckhand_client_connect_timeout = 20
|
||||
deckhand_client_read_timeout = 300
|
||||
drydock_client_connect_timeout = 20
|
||||
drydock_client_read_timeout = 300
|
||||
[shipyard]
|
||||
service_type = shipyard
|
||||
[logging]
|
||||
|
|
|
@ -10,6 +10,10 @@ profiler = false
|
|||
[requests_config]
|
||||
notes_connect_timeout = 5
|
||||
notes_read_timeout = 10
|
||||
validation_connect_timeout = 20
|
||||
validation_read_timeout = 300
|
||||
deckhand_client_connect_timeout = 20
|
||||
deckhand_client_read_timeout = 300
|
||||
drydock_client_connect_timeout = 20
|
||||
drydock_client_read_timeout = 300
|
||||
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
import abc
|
||||
import os
|
||||
import logging
|
||||
import requests
|
||||
|
||||
from keystoneauth1.exceptions.auth import AuthorizationFailure
|
||||
from keystoneauth1.exceptions.catalog import EndpointNotFound
|
||||
from keystoneauth1.identity import v3
|
||||
from keystoneauth1 import session
|
||||
import requests
|
||||
|
||||
from shipyard_client.api_client.client_error import ClientError
|
||||
from shipyard_client.api_client.client_error import UnauthenticatedClientError
|
||||
|
@ -95,7 +95,11 @@ class BaseClient(metaclass=abc.ABCMeta):
|
|||
# This could use keystoneauth1 session, but that library handles
|
||||
# responses strangely (wraps all 400/500 in a keystone exception)
|
||||
response = requests.post(
|
||||
url, data=data, params=query_params, headers=headers)
|
||||
url,
|
||||
data=data,
|
||||
params=query_params,
|
||||
headers=headers,
|
||||
timeout=None)
|
||||
# handle some cases where the response code is sufficient to know
|
||||
# what needs to be done
|
||||
if response.status_code == 401:
|
||||
|
|
|
@ -36,10 +36,12 @@ service_type = kubernetesprovisioner
|
|||
[requests_config]
|
||||
airflow_log_connect_timeout = 5
|
||||
airflow_log_read_timeout = 300
|
||||
deckhand_client_connect_timeout = 5
|
||||
deckhand_client_read_timeout = 300
|
||||
validation_connect_timeout = 5
|
||||
validation_connect_timeout = 20
|
||||
validation_read_timeout = 300
|
||||
deckhand_client_connect_timeout = 20
|
||||
deckhand_client_read_timeout = 300
|
||||
drydock_client_connect_timeout = 20
|
||||
drydock_client_read_timeout = 300
|
||||
[shipyard]
|
||||
service_type = shipyard
|
||||
[oslo_policy]
|
||||
|
|
Loading…
Reference in New Issue