From a06749933569004ef9ee8b709262ed04271c14ba Mon Sep 17 00:00:00 2001 From: TheBurchLog <5104941+TheBurchLog@users.noreply.github.com> Date: Fri, 12 Jul 2024 12:51:02 +0000 Subject: [PATCH 1/7] Include Job ID in export schema --- CHANGELOG.rst | 6 ++++++ brewtils/schemas.py | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0980fd55..4d173769 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ Brewtils Changelog ================== +3.26.4 +------ +TBD + +- Expand Job Export to include Job id + 3.26.3 ------ 7/10/24 diff --git a/brewtils/schemas.py b/brewtils/schemas.py index a1fa4fbe..92427abd 100644 --- a/brewtils/schemas.py +++ b/brewtils/schemas.py @@ -556,7 +556,6 @@ def __init__(self, *args, **kwargs): # exclude fields from a Job that we don't want when we later go to import # the Job definition self.opts.exclude += ( - "id", "next_run_time", "success_count", "error_count", From 18f23e48cf8c911f2fba826451ffdca3a2944953 Mon Sep 17 00:00:00 2001 From: TheBurchLog <5104941+TheBurchLog@users.noreply.github.com> Date: Fri, 12 Jul 2024 12:53:51 +0000 Subject: [PATCH 2/7] fix testing --- brewtils/test/fixtures.py | 1 - 1 file changed, 1 deletion(-) diff --git a/brewtils/test/fixtures.py b/brewtils/test/fixtures.py index 8f940d9d..3996cc8b 100644 --- a/brewtils/test/fixtures.py +++ b/brewtils/test/fixtures.py @@ -629,7 +629,6 @@ def job_dict_for_import(job_dict): """A job dict but some keys and values are missing.""" dict_copy = copy.deepcopy(job_dict) for field in [ - "id", "next_run_time", "success_count", "error_count", From 5e8cf05968ac84e1be34183710a8009e4935859f Mon Sep 17 00:00:00 2001 From: TheBurchLog <5104941+TheBurchLog@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:33:43 +0000 Subject: [PATCH 3/7] Add function to provide read-only of the current request --- CHANGELOG.rst | 6 ++++++ brewtils/__init__.py | 3 ++- brewtils/plugin.py | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0980fd55..e760c369 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ Brewtils Changelog ================== +3.26.4 +------ +TBD + +- Exposed a read only feature to provide the current request that is being processed `from brewtils import get_current_request_read_only` + 3.26.3 ------ 7/10/24 diff --git a/brewtils/__init__.py b/brewtils/__init__.py index 5ac46e04..b757edf2 100644 --- a/brewtils/__init__.py +++ b/brewtils/__init__.py @@ -4,7 +4,7 @@ from brewtils.config import get_argument_parser, get_connection_info, load_config from brewtils.decorators import client, command, parameter, subscribe, system from brewtils.log import configure_logging -from brewtils.plugin import Plugin, RemotePlugin # noqa F401 +from brewtils.plugin import get_current_request_read_only, Plugin, RemotePlugin # noqa F401 from brewtils.rest import normalize_url_prefix from brewtils.rest.easy_client import EasyClient, get_easy_client from brewtils.rest.publish_client import PublishClient @@ -28,6 +28,7 @@ "configure_logging", "normalize_url_prefix", "AutoDecorator", + "get_current_request_read_only" ] # Aliased for compatibility diff --git a/brewtils/plugin.py b/brewtils/plugin.py index 1c07943a..f40b6c35 100644 --- a/brewtils/plugin.py +++ b/brewtils/plugin.py @@ -45,6 +45,13 @@ # Global config, used to simplify BG client creation and sanity checks. CONFIG = Box(default_box=True) +def get_current_request_read_only(): + """ Read-Only instance of Current Request + + Returns a copy of the current request, modifications to this object + does not impact the actual current request + """ + return copy.deepcopy(request_context.current_request) class Plugin(object): """A Beer-garden Plugin From d29e8faba376b86d3d962e24783ca64ea251c7cc Mon Sep 17 00:00:00 2001 From: TheBurchLog <5104941+TheBurchLog@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:40:03 +0000 Subject: [PATCH 4/7] add import statement --- brewtils/plugin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/brewtils/plugin.py b/brewtils/plugin.py index f40b6c35..f129ba6d 100644 --- a/brewtils/plugin.py +++ b/brewtils/plugin.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import copy import json import logging import logging.config From 475841883cdb5f235f455771c9e27f7277709bae Mon Sep 17 00:00:00 2001 From: TheBurchLog <5104941+TheBurchLog@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:41:50 +0000 Subject: [PATCH 5/7] formatting --- brewtils/plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/brewtils/plugin.py b/brewtils/plugin.py index f129ba6d..3da6d847 100644 --- a/brewtils/plugin.py +++ b/brewtils/plugin.py @@ -46,14 +46,16 @@ # Global config, used to simplify BG client creation and sanity checks. CONFIG = Box(default_box=True) + def get_current_request_read_only(): - """ Read-Only instance of Current Request + """Read-Only instance of Current Request Returns a copy of the current request, modifications to this object does not impact the actual current request """ return copy.deepcopy(request_context.current_request) + class Plugin(object): """A Beer-garden Plugin From 6251ea19144765cb10e953c89887f7838c053898 Mon Sep 17 00:00:00 2001 From: TheBurchLog <5104941+TheBurchLog@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:42:48 +0000 Subject: [PATCH 6/7] formatting --- brewtils/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/brewtils/__init__.py b/brewtils/__init__.py index b757edf2..0fe5ec1d 100644 --- a/brewtils/__init__.py +++ b/brewtils/__init__.py @@ -4,7 +4,11 @@ from brewtils.config import get_argument_parser, get_connection_info, load_config from brewtils.decorators import client, command, parameter, subscribe, system from brewtils.log import configure_logging -from brewtils.plugin import get_current_request_read_only, Plugin, RemotePlugin # noqa F401 +from brewtils.plugin import ( + get_current_request_read_only, + Plugin, + RemotePlugin, +) # noqa F401 from brewtils.rest import normalize_url_prefix from brewtils.rest.easy_client import EasyClient, get_easy_client from brewtils.rest.publish_client import PublishClient @@ -28,7 +32,7 @@ "configure_logging", "normalize_url_prefix", "AutoDecorator", - "get_current_request_read_only" + "get_current_request_read_only", ] # Aliased for compatibility From c56cdb933d328a7522a2215a84aa1987e9c03319 Mon Sep 17 00:00:00 2001 From: TheBurchLog <5104941+TheBurchLog@users.noreply.github.com> Date: Fri, 12 Jul 2024 14:49:40 -0400 Subject: [PATCH 7/7] Update plugin.py --- brewtils/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brewtils/plugin.py b/brewtils/plugin.py index 3da6d847..a4724c02 100644 --- a/brewtils/plugin.py +++ b/brewtils/plugin.py @@ -51,7 +51,7 @@ def get_current_request_read_only(): """Read-Only instance of Current Request Returns a copy of the current request, modifications to this object - does not impact the actual current request + do not impact the actual current request """ return copy.deepcopy(request_context.current_request)