Skip to content

Commit

Permalink
Adding logging to pyflyte launch plan activation command (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
wild-endeavor authored May 30, 2020
1 parent 03b5bf1 commit e65b1bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion flytekit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

import flytekit.plugins

__version__ = '0.8.0'
__version__ = '0.8.1'
3 changes: 3 additions & 0 deletions flytekit/clis/sdk_in_container/launch_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import click
import six as _six
import logging as _logging

from flytekit.clis.helpers import construct_literal_map_from_parameter_map as _construct_literal_map_from_parameter_map
from flytekit.clis.sdk_in_container import constants as _constants
Expand Down Expand Up @@ -159,6 +160,7 @@ def activate_all_impl(project, domain, version, pkgs, ignore_schedules=False):
# TODO: We should optionally allow deactivation of missing launch plans

# Discover all launch plans by loading the modules
_logging.info(f"Setting this version's {version} launch plans active in {project} {domain}")
for m, k, lp in iterate_registerable_entities_in_order(
pkgs, include_entities={_SdkLaunchPlan}, detect_unreferenced_entities=False
):
Expand All @@ -170,6 +172,7 @@ def activate_all_impl(project, domain, version, pkgs, ignore_schedules=False):
version
)
if not (lp.is_scheduled and ignore_schedules):
_logging.info(f"Setting active {_utils.fqdn(m.__name__, k, entity_type=lp.resource_type)}")
lp.update(_launch_plan_model.LaunchPlanState.ACTIVE)


Expand Down
9 changes: 7 additions & 2 deletions flytekit/clis/sdk_in_container/pyflyte.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import print_function

import os as _os

import logging as _logging
import click

try:
Expand All @@ -15,7 +15,7 @@
from flytekit.clis.sdk_in_container.serialize import serialize
from flytekit.clis.sdk_in_container.constants import CTX_PROJECT, CTX_DOMAIN, CTX_VERSION
from flytekit.clis.sdk_in_container.launch_plan import launch_plans
from flytekit.configuration import internal as _internal_config, platform as _platform_config
from flytekit.configuration import internal as _internal_config, platform as _platform_config, sdk as _sdk_config

from flytekit.configuration.internal import CONFIGURATION_PATH
from flytekit.configuration.platform import URL as _URL
Expand Down Expand Up @@ -43,6 +43,11 @@ def main(ctx, project, domain, config=None, pkgs=None, version=None, insecure=No
"""
update_configuration_file(config)

# Update the logger if it's set
log_level = _internal_config.LOGGING_LEVEL.get() or _sdk_config.LOGGING_LEVEL.get()
if log_level is not None:
_logging.getLogger().setLevel(log_level)

ctx.obj = dict()
ctx.obj[CTX_PROJECT] = project
ctx.obj[CTX_DOMAIN] = domain
Expand Down

0 comments on commit e65b1bb

Please sign in to comment.