From 22d089213f936e278626b8251e14fef139127c73 Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Sun, 27 Oct 2019 22:52:12 +0300 Subject: [PATCH] #OrchestratorNewStructure_ProcessorTrace --- Orchestrator/Settings/Settings.py | 15 +++++++++++++++ Orchestrator/orchestratorProcessor.py | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Orchestrator/Settings/Settings.py b/Orchestrator/Settings/Settings.py index b31566b9..703a3436 100644 --- a/Orchestrator/Settings/Settings.py +++ b/Orchestrator/Settings/Settings.py @@ -133,6 +133,21 @@ mDict = { } ] + }, + "Processor":{ + "LogList_":"Fill list when orchestrator is running", + "TransactionList_":"List of processor activity, whick was executed", + "TransactionList__":[ + { + "DateTimeStart":"2009-09-01T00:00:00.000Z", + "DateTimeEnd":"2009-09-01T00:00:00.000Z", + "ActivityList":[] + } + ], + "TransactionList":[], + "TransactionTrace_":" if Trace for command is selected for False, the tracing will be off for such activity type", + "TransactionTrace_ActivityCMDRun":True, + }, "ControlPanelDict":{ "RefreshSeconds": 5, diff --git a/Orchestrator/orchestratorProcessor.py b/Orchestrator/orchestratorProcessor.py index 6867a8af..f1de9aef 100644 --- a/Orchestrator/orchestratorProcessor.py +++ b/Orchestrator/orchestratorProcessor.py @@ -5,6 +5,7 @@ import pdb import os import sys import subprocess +import copy import win32ts #Глобальная переменная - все глобальные значения программы global mGlobalDict @@ -50,7 +51,10 @@ def ProcessingRun(inConfigurationDict): #print(mGlobalDict) lDateTimeString=datetime.datetime.strftime(datetime.datetime.now(),"%Y.%m.%d %H:%M:%S::%f") lResult={"dateTime":lDateTimeString, "state":"connected", "actionListResult":[]} - + lTransactionItem={} + #Transaction start + lTransactionItem["DateTimeStart"] = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f") + lTransactionItem["ActivityList"]=[] for lItem in inConfigurationDict["actionList"]: #Добавить входные значения lResult["actionListResult"].append({"inArgs":lItem}) @@ -130,5 +134,15 @@ def ProcessingRun(inConfigurationDict): #pdb.set_trace() lResult["actionListResult"][-1]["key_list"]=lItem["key_list"] lResult["actionListResult"][-1]["value"]=lGlobalDict.get(lItem["key_list"][-1],None) + ################## + #Trace activity + ################## + if mGlobalDict["Processor"].get(f"TransactionTrace_{lItem['type']}",True): + #Add activity in TransactionList if it is applicable + lTransactionItem["ActivityList"].append(copy.deepcopy(lItem)) + #Transaction end + lTransactionItem["DateTimeEnd"] = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f") + #Перенос результатов в TransactionList + mGlobalDict["Processor"]["TransactionList"].append(lTransactionItem) #Вернуть результат return lResult