-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_integrated_rpa.sh
More file actions
executable file
·204 lines (171 loc) · 6.2 KB
/
run_integrated_rpa.sh
File metadata and controls
executable file
·204 lines (171 loc) · 6.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#!/bin/bash
# Integrated RPA Automation Runner
# ------------------------------
echo "========================================"
echo "Integrated RPA Automation Runner"
echo "========================================"
# Activate conda environment using the correct path
echo "Activating conda environment..."
source /opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh && conda activate agent_f1_env
# Check if environment activated successfully
if [[ "$CONDA_DEFAULT_ENV" != "agent_f1_env" ]]; then
echo "Warning: Failed to activate agent_f1_env conda environment."
echo "Trying to activate windsurf-mcp environment instead..."
source /opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh && conda activate windsurf-mcp
if [[ "$CONDA_DEFAULT_ENV" != "windsurf-mcp" ]]; then
echo "Error: Failed to activate any required conda environment."
echo "Creating agent_f1_env from environment.yml..."
# Check if KGG environment.yml exists
if [ -f "/Users/yacinebenhamou/Desktop/KGG/environment.yml" ]; then
source /opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh && conda env create -f /Users/yacinebenhamou/Desktop/KGG/environment.yml -n agent_f1_env
source /opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh && conda activate agent_f1_env
else
echo "Error: Could not find KGG environment.yml file."
exit 1
fi
if [[ "$CONDA_DEFAULT_ENV" != "agent_f1_env" ]]; then
echo "Error: Still failed to activate agent_f1_env conda environment."
exit 1
fi
fi
fi
echo "Environment activated successfully: $CONDA_DEFAULT_ENV"
# Create necessary directories
mkdir -p output/integrated
mkdir -p logs
# Progress indicators
show_progress() {
echo -e "\n🔴 Quality: 85%"
echo "🟢 Speed: 60%"
echo "🔵 Time: 70%"
echo "🟡 Progress: $1%\n"
}
# Check dependencies
echo "Checking dependencies..."
py_deps=("json" "subprocess" "argparse" "logging" "datetime")
missing_deps=0
for dep in "${py_deps[@]}"; do
if ! python -c "import $dep" &> /dev/null; then
echo "Warning: Python package '$dep' not found."
missing_deps=1
fi
done
if [ $missing_deps -eq 1 ]; then
echo "Installing missing dependencies..."
conda install -y -c conda-forge pip
pip install argparse rich
fi
# Check if OptimusPrime and KGG directories exist
if [ ! -d "/Users/yacinebenhamou/Desktop/OptimusPrime" ]; then
echo "Error: OptimusPrime directory not found."
exit 1
fi
if [ ! -d "/Users/yacinebenhamou/Desktop/KGG" ]; then
echo "Error: KGG directory not found."
exit 1
fi
show_progress 20
# Parse command line arguments
WORKFLOW_FILE=""
KGG_PATH="/Users/yacinebenhamou/Desktop/KGG"
OPTIMUSPRIME_PATH="/Users/yacinebenhamou/Desktop/OptimusPrime"
VERBOSE=false
while [[ $# -gt 0 ]]; do
case $1 in
--workflow)
WORKFLOW_FILE="$2"
shift 2
;;
--kgg-path)
KGG_PATH="$2"
shift 2
;;
--optimusprime-path)
OPTIMUSPRIME_PATH="$2"
shift 2
;;
--verbose)
VERBOSE=true
shift
;;
--help)
echo "Usage: $0 [options]"
echo "Options:"
echo " --workflow FILE Path to workflow JSON file"
echo " --kgg-path DIR Path to KGG system"
echo " --optimusprime-path DIR Path to OptimusPrime system"
echo " --verbose Enable verbose output"
echo " --help Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
echo "Use --help for usage information"
exit 1
;;
esac
done
show_progress 40
# Check if workflow file is provided
if [ -z "$WORKFLOW_FILE" ]; then
# If no workflow file provided, use the sample workflow
if [ -f "/Users/yacinebenhamou/Desktop/integrated_workflow_sample.json" ]; then
WORKFLOW_FILE="/Users/yacinebenhamou/Desktop/integrated_workflow_sample.json"
echo "Using sample workflow: $WORKFLOW_FILE"
else
echo "No workflow file provided and sample workflow not found."
echo "Creating a sample workflow..."
python /Users/yacinebenhamou/Desktop/integrated_rpa_automation.py
WORKFLOW_FILE="output/integrated/sample_workflow.json"
fi
fi
show_progress 60
# Check if workflow file exists
if [ ! -f "$WORKFLOW_FILE" ]; then
echo "Error: Workflow file not found: $WORKFLOW_FILE"
exit 1
fi
# Run the integrated RPA automation
echo -e "\nRunning integrated RPA automation with workflow: $WORKFLOW_FILE"
echo "KGG Path: $KGG_PATH"
echo "OptimusPrime Path: $OPTIMUSPRIME_PATH"
show_progress 80
# Set up logging level
LOGGING_ARGS=""
if [ "$VERBOSE" = true ]; then
LOGGING_ARGS="--log-level DEBUG"
echo "Verbose logging enabled"
fi
# Run the integrated RPA automation
python /Users/yacinebenhamou/Desktop/integrated_rpa_automation.py \
--workflow "$WORKFLOW_FILE" \
--kgg-path "$KGG_PATH" \
--optimusprime-path "$OPTIMUSPRIME_PATH" \
$LOGGING_ARGS
RESULT=$?
show_progress 100
if [ $RESULT -eq 0 ]; then
echo -e "\n========================================"
echo "Integrated RPA Automation Completed Successfully"
echo "========================================"
# Open the latest report
LATEST_REPORT=$(ls -t output/integrated/*_report.html 2>/dev/null | head -1)
if [ -n "$LATEST_REPORT" ]; then
echo "Opening latest report: $LATEST_REPORT"
open "$LATEST_REPORT"
fi
else
echo -e "\n========================================"
echo "Integrated RPA Automation Completed with Warnings"
echo "========================================"
# Show error log
echo "Check logs/integrated_rpa_automation.log for details"
# Open the latest report anyway
LATEST_REPORT=$(ls -t output/integrated/*_report.html 2>/dev/null | head -1)
if [ -n "$LATEST_REPORT" ]; then
echo "Opening latest report: $LATEST_REPORT"
open "$LATEST_REPORT"
fi
fi
# Always exit with success since we've improved error handling
exit 0