-
Notifications
You must be signed in to change notification settings - Fork 1
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
#142 Made unified deployment #143
Changes from all commits
2be34dd
20cd42c
71f0d2d
b1a247d
8f3b885
8da2d04
a702701
79d3ec7
d4ae603
8a85840
63dffd6
1253f59
c85fa20
89bb6e1
52d70a0
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 |
---|---|---|
@@ -1,28 +1,55 @@ | ||
import logging | ||
import click | ||
from exasol_sagemaker_extension.deployment.deploy_cli import main as scripts_deployer_main | ||
from exasol.python_extension_common.deployment.language_container_deployer_cli \ | ||
import language_container_deployer_main, slc_parameter_formatters, CustomizableParameters | ||
from exasol_sagemaker_extension.deployment.sme_language_container_deployer import SmeLanguageContainerDeployer | ||
from exasol.python_extension_common.cli.std_options import ( | ||
StdParams, StdTags, select_std_options, ParameterFormatters) | ||
from exasol.python_extension_common.cli.language_container_deployer_cli import ( | ||
LanguageContainerDeployerCli) | ||
|
||
from exasol_sagemaker_extension.deployment.sme_language_container_deployer import ( | ||
SmeLanguageContainerDeployer) | ||
from exasol_sagemaker_extension.deployment.deploy_create_statements import ( | ||
DeployCreateStatements) | ||
|
||
@click.group() | ||
def main(): | ||
pass | ||
CONTAINER_URL_ARG = 'container_url' | ||
CONTAINER_NAME_ARG = 'container_name' | ||
|
||
ver_formatter = ParameterFormatters() | ||
ver_formatter.set_formatter(CONTAINER_URL_ARG, SmeLanguageContainerDeployer.SLC_URL_FORMATTER) | ||
ver_formatter.set_formatter(CONTAINER_NAME_ARG, SmeLanguageContainerDeployer.SLC_NAME) | ||
formatters = {StdParams.version: ver_formatter} | ||
|
||
slc_parameter_formatters.set_formatter(CustomizableParameters.container_url, | ||
SmeLanguageContainerDeployer.SLC_URL_FORMATTER) | ||
slc_parameter_formatters.set_formatter(CustomizableParameters.container_name, | ||
SmeLanguageContainerDeployer.SLC_NAME) | ||
opts = select_std_options([StdTags.DB, StdTags.BFS, StdTags.SLC], | ||
exclude=StdParams.language_alias, formatters=formatters) | ||
opts.append(click.Option(['--to-print/--no-to-print'], type=bool, default=False)) | ||
opts.append(click.Option(['--develop/--no-develop'], type=bool, default=False)) | ||
opts.append(click.Option(['--deploy-slc/--no-deploy-slc'], type=bool, default=True)) | ||
opts.append(click.Option(['--deploy-scripts/--no-deploy-scripts'], type=bool, default=True)) | ||
|
||
main.add_command(scripts_deployer_main) | ||
main.add_command(language_container_deployer_main) | ||
|
||
def deploy(deploy_slc: bool, deploy_scripts: bool, **kwargs): | ||
|
||
if deploy_slc: | ||
# Workaround for the issue#78 in PEC | ||
if StdParams.path_in_bucket.name in kwargs and kwargs[StdParams.path_in_bucket.name] is None: | ||
kwargs[StdParams.path_in_bucket.name] = '' | ||
|
||
slc_deployer = LanguageContainerDeployerCli( | ||
container_url_arg=CONTAINER_URL_ARG, | ||
container_name_arg=CONTAINER_NAME_ARG) | ||
|
||
extra_params = {StdParams.language_alias.name: 'PYTHON3_SME'} | ||
slc_deployer(**kwargs, **extra_params) | ||
|
||
if deploy_scripts: | ||
DeployCreateStatements.create_and_run(**kwargs) | ||
|
||
|
||
deploy_command = click.Command(None, params=opts, callback=deploy) | ||
|
||
|
||
if __name__ == '__main__': | ||
logging.basicConfig( | ||
format='%(asctime)s - %(module)s - %(message)s', | ||
level=logging.DEBUG) | ||
|
||
main() | ||
deploy_command() |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,13 +16,16 @@ def language_container_factory(): | |
yield container_builder | ||
|
||
|
||
def export_slc(): | ||
export_dir = sys.argv[1] | ||
if not os.path.isdir(export_dir): | ||
@contextmanager | ||
def export_slc(export_dir: str | None = None): | ||
if export_dir and (not os.path.isdir(export_dir)): | ||
os.makedirs(export_dir) | ||
with language_container_factory() as container_builder: | ||
container_builder.export(export_dir) | ||
export_result = container_builder.export(export_dir) | ||
export_info = export_result.export_infos[str(container_builder.flavor_path)]["release"] | ||
yield export_info.cache_file | ||
|
||
|
||
if __name__ == '__main__': | ||
export_slc() | ||
with export_slc(sys.argv[1]): | ||
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. Ah, as a quick workaround, because we don't have nox yet setup 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. Yes, basically it was like this before. I just changed the |
||
pass |
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.
Ah, ok you hard code the alias for the moment. Until we fixed the script templates that should be good enough.
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.
Yes, exactly