-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#52: Added CLI options for specifying the timeout for the ExtractValidator #57
Changes from 3 commits
1cbea4c
d8a8354
d48d814
fb8a6db
fb7c804
f05df2e
6bcc7c5
49001a4
35515e6
35935ba
9ad438f
e485862
d5ab544
6680405
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,10 @@ def get_udf_path(bucket_base_path: bfs.path.PathLike, bucket_file: str) -> PureP | |
return PurePosixPath(file_path.as_udf_path()) | ||
|
||
|
||
def display_extract_progress(n: int, pending: List[int]): | ||
logger.info(f"Verify extraction: {len(pending)} of {n} nodes pending, IDs: {pending}") | ||
|
||
|
||
class LanguageContainerDeployer: | ||
|
||
def __init__(self, | ||
|
@@ -306,7 +310,10 @@ def create(cls, | |
path_in_bucket: str = '', | ||
use_ssl_cert_validation: bool = True, ssl_trusted_ca: Optional[str] = None, | ||
ssl_client_certificate: Optional[str] = None, | ||
ssl_private_key: Optional[str] = None) -> "LanguageContainerDeployer": | ||
ssl_private_key: Optional[str] = None, | ||
extract_timeout: timedelta = timedelta(seconds=10), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A proper value for a timeout is beyond 10 minutes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will set it to 10 minutes, see next push. |
||
display_progress: bool = False, | ||
) -> "LanguageContainerDeployer": | ||
|
||
# Infer where the database is - on-prem or SaaS. | ||
if all((dsn, db_user, db_password, bucketfs_host, bucketfs_port, | ||
|
@@ -359,4 +366,6 @@ def create(cls, | |
encryption=True, | ||
websocket_sslopt=websocket_sslopt) | ||
|
||
return cls(pyexasol_conn, language_alias, bucketfs_path) | ||
callback = display_extract_progress if display_progress else None | ||
extract_validator = ExtractValidator(pyexasol_conn, extract_timeout, callback=callback) | ||
return cls(pyexasol_conn, language_alias, bucketfs_path, extract_validator) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
from pathlib import Path | ||
import click | ||
from exasol.python_extension_common.deployment.language_container_deployer import LanguageContainerDeployer | ||
from datetime import timedelta | ||
|
||
|
||
class CustomizableParameters(Enum): | ||
|
@@ -152,6 +153,9 @@ def secret_callback(ctx: click.Context, param: click.Option, value: Any): | |
@click.option('--alter-system/--no-alter-system', type=bool, default=True) | ||
@click.option('--allow-override/--disallow-override', type=bool, default=False) | ||
@click.option('--wait_for_completion/--no-wait_for_completion', type=bool, default=True) | ||
@click.option('--extract-timeout-minutes', type=int, default=5) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would set the default at least to 10 minutes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See next push. |
||
# @click.option('--extract-check-interval-seconds', type=int, default=10) | ||
@click.option('--display-progress/--no-display-progress', type=bool, default=True) | ||
def language_container_deployer_main( | ||
bucketfs_name: str, | ||
bucketfs_host: str, | ||
|
@@ -179,6 +183,8 @@ def language_container_deployer_main( | |
alter_system: bool, | ||
allow_override: bool, | ||
wait_for_completion: bool, | ||
extract_timeout_minutes: int, | ||
display_progress: bool, | ||
container_url: Optional[str] = None, | ||
container_name: Optional[str] = None): | ||
|
||
|
@@ -203,7 +209,10 @@ def language_container_deployer_main( | |
ssl_trusted_ca=ssl_cert_path, | ||
ssl_client_certificate=ssl_client_cert_path, | ||
ssl_private_key=ssl_client_private_key, | ||
use_ssl_cert_validation=use_ssl_cert_validation) | ||
use_ssl_cert_validation=use_ssl_cert_validation, | ||
extract_timeout=timedelta(minutes=extract_timeout_minutes), | ||
display_progress=display_progress, | ||
) | ||
|
||
if not upload_container: | ||
deployer.run(alter_system=alter_system, allow_override=allow_override, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How often would this be called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on the settings.
So with these setting, by default the callback will be called 10*60/10 = 60 times at max.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably, would increase the interval to 30 seconds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - changed in latest push.