Skip to content

Commit c9470b5

Browse files
committed
finalise log analysis
1 parent 4387ea1 commit c9470b5

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

patchwork/patchflows/LogAnalysis/LogAnalysis.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import os
23
from pathlib import Path
34

45
import yaml
@@ -15,26 +16,19 @@
1516
class LogAnalysis(Step):
1617
def __init__(self, inputs: dict):
1718
PatchflowProgressBar(self).register_steps(
18-
# CallSQL,
1919
AgenticLLMV2,
2020
)
2121
final_inputs = yaml.safe_load(_DEFAULT_INPUT_FILE.read_text()) or dict()
2222
final_inputs.update(inputs)
2323

2424
validate_steps_with_inputs(
2525
set(final_inputs.keys()).union({""}),
26-
# CallSQL,
2726
AgenticLLMV2,
2827
)
2928

3029
self.inputs = final_inputs
3130

3231
def run(self) -> dict:
33-
# output = CallSQL(self.inputs).run()
34-
# self.inputs.update(output)
35-
36-
log_filename = "gcp_logs.log"
37-
sentry_filename = "sentry_issues.json"
3832
for i in range(self.inputs.get("analysis_limit") or 5):
3933
# for i in range(self.inputs.get("log_finding_limit") or sys.maxsize):
4034
logs_detection_output = AgenticLLMV2(
@@ -46,12 +40,9 @@ def run(self) -> dict:
4640
Explore the logs and reply with the relevant logs position, the file path and line number.
4741
""",
4842
user_prompt=f"""\
49-
The log file {log_filename} from GCP and the sentry logs can be found at {sentry_filename}.
43+
Logs are uploaded to the current working directory at {os.getcwd()}.
5044
51-
Here are some relevant information:
52-
Custom Patchflow Id: 5826
53-
Organisation Id: 301
54-
Repository Id: 456
45+
{self.inputs.get('query')}
5546
""",
5647
example_json="""
5748
{
@@ -94,6 +85,7 @@ def run(self) -> dict:
9485
if analysis_output.get("is_log_analysis_done", False):
9586
break
9687

97-
logger.info(json.dumps(logs_detection_output))
98-
logger.info(json.dumps(analysis_output))
88+
logger.info("Log Analysis Complete")
89+
logger.info("Message:")
90+
logger.info(json.dumps(analysis_output.get("message")))
9991
return dict()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
query: ""

0 commit comments

Comments
 (0)