Skip to content

Commit ad446ed

Browse files
committed
Add simulation request script for GridAPPSD integration
- Created a new Python script (temp.py) to send simulation requests to GridAPPSD. - Configured environment variables for GridAPPSD user credentials. - Defined a request structure for two geographical regions with specific simulation configurations. - Implemented response handling to print the output from the GridAPPSD service.
1 parent 3028023 commit ad446ed

7 files changed

Lines changed: 227 additions & 31 deletions

File tree

.github/workflows/deploy-dev-release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,20 @@ jobs:
167167
```
168168
token: ${{ secrets.GITHUB_TOKEN }}
169169

170+
- name: Verify package available on PyPI
171+
if: github.repository_owner == 'GRIDAPPSD'
172+
run: |
173+
for i in $(seq 1 30); do
174+
if pip index versions gridappsd-python 2>/dev/null | grep -q "${{ env.NEW_VERSION }}" || \
175+
pip install --dry-run --no-deps "gridappsd-python==${{ env.NEW_VERSION }}" 2>/dev/null; then
176+
echo "Package gridappsd-python==${{ env.NEW_VERSION }} is available on PyPI"
177+
exit 0
178+
fi
179+
echo "Attempt $i/30: Package not yet available, waiting 10s..."
180+
sleep 10
181+
done
182+
echo "Warning: Package not confirmed on PyPI after 5 minutes, proceeding anyway"
183+
170184
# Docker build and push
171185
- name: Set up Docker Buildx
172186
uses: docker/setup-buildx-action@v3

.github/workflows/release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,20 @@ jobs:
111111
name: "Release ${{ env.VERSION }}"
112112
token: ${{ secrets.GITHUB_TOKEN }}
113113

114+
- name: Verify package available on PyPI
115+
if: github.repository_owner == 'GRIDAPPSD'
116+
run: |
117+
for i in $(seq 1 30); do
118+
if pip index versions gridappsd-python 2>/dev/null | grep -q "${{ env.VERSION }}" || \
119+
pip install --dry-run --no-deps "gridappsd-python==${{ env.VERSION }}" 2>/dev/null; then
120+
echo "Package gridappsd-python==${{ env.VERSION }} is available on PyPI"
121+
exit 0
122+
fi
123+
echo "Attempt $i/30: Package not yet available, waiting 10s..."
124+
sleep 10
125+
done
126+
echo "Warning: Package not confirmed on PyPI after 5 minutes, proceeding anyway"
127+
114128
# Docker build and push
115129
- name: Set up Docker Buildx
116130
uses: docker/setup-buildx-action@v3

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ WORKDIR /app
6363
# Install gridappsd-python
6464
# If GRIDAPPSD_PYTHON_VERSION is set (e.g., "==2025.3.2"), use it
6565
# Otherwise install latest from PyPI
66+
# --pre allows installing prerelease versions (e.g., 2025.3.2a15)
6667
RUN pip install --upgrade pip \
67-
&& pip install gridappsd-python${GRIDAPPSD_PYTHON_VERSION:-}
68+
&& pip install --pre gridappsd-python${GRIDAPPSD_PYTHON_VERSION:-}
6869

6970
# Default command shows installed version
7071
CMD ["python", "-c", "import gridappsd; print(f'gridappsd-python version: {gridappsd.__version__}')"]

compute_req_log.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[COMPUTE_REQ] 2026-02-06 14:28:12,596 - Total message size summary:
2+
[COMPUTE_REQ] 2026-02-06 14:28:12,596 - Function call counts summary:
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "fa474e10",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from gridappsd import GridAPPSD\n",
11+
"import gridappsd.topics as topics"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": 2,
17+
"id": "341dcd4e",
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"addr = [\"localhost\", 61613]\n",
22+
"user = \"system\"\n",
23+
"password = \"manager\""
24+
]
25+
},
26+
{
27+
"cell_type": "code",
28+
"execution_count": 3,
29+
"id": "54a6492b",
30+
"metadata": {},
31+
"outputs": [
32+
{
33+
"data": {
34+
"text/plain": [
35+
"True"
36+
]
37+
},
38+
"execution_count": 3,
39+
"metadata": {},
40+
"output_type": "execute_result"
41+
}
42+
],
43+
"source": [
44+
"g = GridAPPSD(address=addr, username=user, password=password)\n",
45+
"g.connect()\n",
46+
"g.connected\n"
47+
]
48+
},
49+
{
50+
"cell_type": "code",
51+
"execution_count": 7,
52+
"id": "59297d02",
53+
"metadata": {},
54+
"outputs": [
55+
{
56+
"name": "stdout",
57+
"output_type": "stream",
58+
"text": [
59+
"goss.gridappsd.process.request.data.powergridmodel\n"
60+
]
61+
}
62+
],
63+
"source": [
64+
"message = {\n",
65+
" \"requestType\": \"QUERY_MODEL_NAMES\",\n",
66+
" \"resultFormat\": \"JSON\"\n",
67+
"}\n",
68+
"print(topics.REQUEST_POWERGRID_DATA)\n",
69+
"#g.get_response(topics.REQUEST_POWERGRID_DATA, message, timeout=120)"
70+
]
71+
},
72+
{
73+
"cell_type": "code",
74+
"execution_count": null,
75+
"id": "4b8584a1",
76+
"metadata": {},
77+
"outputs": [],
78+
"source": []
79+
}
80+
],
81+
"metadata": {
82+
"kernelspec": {
83+
"display_name": "gridappsd-python-py3.13",
84+
"language": "python",
85+
"name": "python3"
86+
},
87+
"language_info": {
88+
"codemirror_mode": {
89+
"name": "ipython",
90+
"version": 3
91+
},
92+
"file_extension": ".py",
93+
"mimetype": "text/x-python",
94+
"name": "python",
95+
"nbconvert_exporter": "python",
96+
"pygments_lexer": "ipython3",
97+
"version": "3.13.5"
98+
}
99+
},
100+
"nbformat": 4,
101+
"nbformat_minor": 5
102+
}

0 commit comments

Comments
 (0)