Skip to content

Commit

Permalink
Adding debug mode to recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbourret committed Dec 13, 2022
1 parent 265d818 commit 77f12f3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
8 changes: 8 additions & 0 deletions custom-recipes/pi-system-retrieve-event-frames/recipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@
"visibilityCondition": "model.show_advanced_parameters==true && model.is_ssl_check_disabled==false",
"mandatory": false
},
{
"name": "is_debug_mode",
"label": "Verbose logging",
"visibilityCondition": "model.show_advanced_parameters==true",
"type": "BOOLEAN",
"description": "",
"defaultValue": false
},
{
"name": "use_batch_mode",
"label": "Use batch mode",
Expand Down
5 changes: 3 additions & 2 deletions custom-recipes/pi-system-retrieve-event-frames/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dataiku.customrecipe import get_input_names_for_role, get_recipe_config, get_output_names_for_role
import pandas as pd
from safe_logger import SafeLogger
from osisoft_plugin_common import get_credentials, get_interpolated_parameters, get_advanced_parameters
from osisoft_plugin_common import get_credentials, get_interpolated_parameters, get_advanced_parameters, check_debug_mode
from osisoft_constants import OSIsoftConstants
from osisoft_client import OSIsoftClient

Expand All @@ -22,6 +22,7 @@
logger.info("Initialization with config={}".format(logger.filter_secrets(config)))

auth_type, username, password, server_url, is_ssl_check_disabled = get_credentials(config)
is_debug_mode = check_debug_mode(config)

use_server_url_column = config.get("use_server_url_column", False)
if not server_url and not use_server_url_column:
Expand Down Expand Up @@ -64,7 +65,7 @@
event_frame_webid = input_parameters_row.get("WebId")

if client is None or previous_server_url != server_url:
client = OSIsoftClient(server_url, auth_type, username, password, is_ssl_check_disabled=is_ssl_check_disabled)
client = OSIsoftClient(server_url, auth_type, username, password, is_ssl_check_disabled=is_ssl_check_disabled, is_debug_mode=is_debug_mode)
previous_server_url = server_url
object_id = input_parameters_row.get(path_column)
item = None
Expand Down
8 changes: 8 additions & 0 deletions custom-recipes/pi-system-retrieve-list/recipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@
"visibilityCondition": "model.show_advanced_parameters==true && model.is_ssl_check_disabled==false",
"mandatory": false
},
{
"name": "is_debug_mode",
"label": "Verbose logging",
"visibilityCondition": "model.show_advanced_parameters==true",
"type": "BOOLEAN",
"description": "",
"defaultValue": false
},
{
"type": "SEPARATOR",
"description": "Source"
Expand Down
10 changes: 7 additions & 3 deletions custom-recipes/pi-system-retrieve-list/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from dataiku.customrecipe import get_input_names_for_role, get_recipe_config, get_output_names_for_role
import pandas as pd
from safe_logger import SafeLogger
from osisoft_plugin_common import get_credentials, get_interpolated_parameters, normalize_af_path, get_combined_description, get_base_for_data_type
from osisoft_plugin_common import (
get_credentials, get_interpolated_parameters, normalize_af_path,
get_combined_description, get_base_for_data_type, check_debug_mode
)
from osisoft_client import OSIsoftClient
from osisoft_constants import OSIsoftConstants

Expand All @@ -21,6 +24,7 @@
logger.info("Initialization with config config={}".format(logger.filter_secrets(config)))

auth_type, username, password, server_url, is_ssl_check_disabled = get_credentials(config)
is_debug_mode = check_debug_mode(config)

use_server_url_column = config.get("use_server_url_column", False)
if not server_url and not use_server_url_column:
Expand Down Expand Up @@ -56,7 +60,7 @@
end_time = input_parameters_row.get(end_time_column, end_time) if use_end_time_column else end_time

if client is None or previous_server_url != server_url:
client = OSIsoftClient(server_url, auth_type, username, password, is_ssl_check_disabled=is_ssl_check_disabled)
client = OSIsoftClient(server_url, auth_type, username, password, is_ssl_check_disabled=is_ssl_check_disabled, is_debug_mode=is_debug_mode)
previous_server_url = server_url
object_id = input_parameters_row.get(path_column)
item = None
Expand All @@ -73,7 +77,7 @@
sync_time=sync_time,
boundary_type=boundary_type,
can_raise=False,
object_id = object_id
object_id=object_id
)
else:
rows = client.get_row_from_webid(
Expand Down

0 comments on commit 77f12f3

Please sign in to comment.