Skip to content

Commit 1168136

Browse files
tonya1craig8
andauthored
Release of version 2024.09.0 (#65)
* Gridlab-d is introducing breaking changes. Update gridlab-d branch to gridappsd-branch to maintain functionality. * Testing 3.10 * Update to python 3.10. No longer need 2 stage build * Update python 3.10 * Add gridappsd branch (#61) * Develop (#49) * Update Dockerfile.gridappsd_base Pin helics to v2.6.1 per Andy's request. * Update main.yml Fix tag parsing for github actions * helics 2.7.1 (#45) * Split build, add helics 2.7 back (#47) * Update main.yml * Update main.yml Docker tag parsing * Gridlab-d is introducing breaking changes. Update gridlab-d branch to gridappsd-branch to maintain functionality. (#51) * Gridlab-d is introducing breaking changes. Update gridlab-d branch to gridappsd-branch to maintain functionality. (#52) * Gridlab-d is introducing breaking changes. Update gridlab-d branch to gridappsd-branch to maintain functionality. (#53) * Gridlab-d is introducing breaking changes. Update gridlab-d branch to gridappsd-branch to maintain functionality. (#54) * Gridlab-d is introducing breaking changes. Update gridlab-d branch to gridappsd-branch to maintain functionality. (#55) * Gridlab-d is introducing breaking changes. Update gridlab-d branch to gridappsd-branch to maintain functionality. (#56) * Update scripts (#64) --------- Co-authored-by: Craig <[email protected]>
1 parent 665e946 commit 1168136

File tree

4 files changed

+175
-154
lines changed

4 files changed

+175
-154
lines changed

README.md

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ This repository is used to build the base container for gridappsd.
44

55
It also includes a few scripts one to create the releases and another to create a blazegraph container.
66

7-
./scripts/release/create_release.sh - Requires github username and token.
7+
8+
9+
## Create a gridappsd release
810

911
To create a release, the create_release.sh script is run multiple times, between each run there are manual testing and validation steps.
12+
Requires github username and token.
1013

1114
### 1. Clone the build repository ###
1215
```
@@ -61,10 +64,30 @@ cd ../../../gridappsd-docker
6164
./run.sh -t vVERSION
6265
```
6366

64-
./create_blazegraph.sh - From the lyrasis/blazegraph:2.1.4 container,
65-
* add a custom configuration file
66-
* from https://github.com/GRIDAPPSD/Powergrid-Models/
67-
* import the XML files
68-
* extract the measurements
69-
* import measurements
70-
* add the houses
67+
68+
69+
## Build the blazegraph container
70+
71+
### 1. Clone the build repository ###
72+
```
73+
git clone https://github.com/GRIDAPPSD/gridappsd-docker-build
74+
```
75+
76+
### 2. Create a virtual environment and install the python requirements ###
77+
```
78+
python3 -m venv .venv
79+
source .venv/bin/activate
80+
pip install -r requirements_blazegraph.txt
81+
```
82+
83+
### 3. Run the create_release.sh script to create the local blazegraph container ###
84+
```
85+
./create_blazegraph.sh
86+
```
87+
- pulls the base lyrasis container
88+
- clones the GitHub repositories for the CIMHub and Powergrid0Models
89+
- imports the PowerGridModels/platform/ files, and inserts measurements and houses
90+
91+
### 4. Verify the import was successfull ###
92+
Review the bzbuild/build_timestamp/create.log file to verify all files, measurements, and houses were imported correctly.
93+

create_blazegraph.sh

Lines changed: 51 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
# print instructions for committing the build container, tagging and pushing to dockerhub
1111
####
1212

13+
# set the tag container
14+
GRIDAPPSD_TAG=':develop'
15+
16+
17+
export PYTHONWARNINGS="ignore"
18+
1319
usage () {
1420
/bin/echo "Usage: $0 [-d]"
1521
/bin/echo " -d debug"
@@ -55,14 +61,42 @@ http_status_container() {
5561
fi
5662
}
5763

64+
build_dir=bzbuild/build_$(date +"%Y%m%d%H%M%S")
65+
66+
if [ -d $build_dir ]; then
67+
echo "$build_dir exists"
68+
echo "Exiting..."
69+
exit 1
70+
fi
71+
72+
echo "Build directory: $build_dir"
73+
mkdir -p $build_dir
74+
cp $0 $build_dir
75+
cp Dockerfile.gridappsd_blazegraph $build_dir
76+
mkdir ${build_dir}/conf
77+
cp -rp ./conf/rwstore.properties ${build_dir}/conf
78+
cd $build_dir
79+
80+
echo "Logging to : ${build_dir}/create.log"
81+
82+
# Close STDOUT file descriptor
83+
exec 1<&-
84+
# Close STDERR FD
85+
exec 2<&-
86+
87+
# Open STDOUT as $LOG_FILE file for read and write.
88+
exec 1<>create.log
89+
90+
# Redirect STDERR to STDOUT
91+
exec 2>&1
92+
93+
date
94+
5895
url_viz="http://localhost:8080/"
59-
blazegraph_models="ACEP_PSIL.xml EPRI_DPV_J1.xml IEEE123.xml IEEE123_PV.xml IEEE13.xml IEEE13_Assets.xml IEEE8500.xml IEEE8500_3subs.xml R2_12_47_2.xml"
60-
url_blazegraph="http://localhost:8889/bigdata/"
61-
data_dir="Powergrid-Models/blazegraph/test"
96+
url_blazegraph="http://localhost:8889/bigdata/namespace/kb/"
97+
data_dir="Powergrid-Models/platform/cimxml"
6298
debug=0
6399
exists=0
64-
# set the default tag for the gridappsd and viz containers
65-
GRIDAPPSD_TAG=':develop'
66100

67101
# parse options
68102
while getopts dpt: option ; do
@@ -114,7 +148,8 @@ if [ -d Powergrid-Models ]; then
114148
git pull -v
115149
cd $cwd
116150
else
117-
git clone http://github.com/GRIDAPPSD/Powergrid-Models -b develop
151+
git clone http://github.com/GRIDAPPSD/Powergrid-Models -b gridappsd
152+
git clone http://github.com/GRIDAPPSD/CIMHub -b gridappsd
118153
fi
119154

120155
GITHASH=`git -C Powergrid-Models log -1 --pretty=format:"%h"`
@@ -123,118 +158,24 @@ http_status_container 'blazegraph'
123158

124159
bz_load_status=0
125160
echo " "
126-
echo "Checking blazegraph data"
161+
echo "Importing blazegraph data"
127162

128-
echo " "
129-
# Check if blazegraph data is already loaded
130-
rangeCount=`curl -s -G -H 'Accept: application/xml' "${url_blazegraph}sparql" --data-urlencode ESTCARD | sed 's/.*rangeCount=\"\([0-9]*\)\".*/\1/'`
131-
if [ x"$rangeCount" == x"0" ]; then
132-
for blazegraph_file in $blazegraph_models; do
133-
echo "Ingesting blazegraph data $data_dir/$blazegraph_file ${url_blazegraph}sparql ($rangeCount)"
134-
debug_msg "curl -s -D- -H 'Content-Type: application/xml' --upload-file \"$data_dir/$blazegraph_file\" -X POST \"${url_blazegraph}sparql\""
135-
curl_output=`curl -s -D- -H 'Content-Type: application/xml' --upload-file "$data_dir/$blazegraph_file" -X POST "${url_blazegraph}sparql"`
136-
debug_msg "curl output: $curl_output"
137-
bz_status=`echo $curl_output | grep -c 'data modified='`
138-
139-
if [ ${bz_status:-0} -ne 1 ]; then
140-
echo "Error could not ingest blazegraph data file $data_dir/$blazegraph_file"
141-
echo $curl_output
142-
bz_load_status=1
143-
fi
144-
#echo "Verifying blazegraph data"
145-
rangeCount=`curl -s -G -H 'Accept: application/xml' "${url_blazegraph}sparql" --data-urlencode ESTCARD | sed 's/.*rangeCount=\"\([0-9]*\)\".*/\1/'`
146-
done
147-
148-
if [ ${rangeCount:-0} -gt 0 -a $bz_load_status == 0 ]; then
149-
echo "Finished ingesting blazegraph data files ($rangeCount)"
150-
else
151-
echo "Error ingesting blazegraph data files ($rangeCount)"
152-
echo "Exiting "
153-
echo " "
154-
#echo $curl_output
155-
exit 1
156-
fi
157-
else
158-
echo "Error Blazegrpah already contains data ($rangeCount)"
159-
exit 1
163+
cd Powergrid-Models/platform
164+
if [ ! -f envars.sh ]; then
165+
cp envars_docker.sh envars.sh
160166
fi
161-
162-
echo " "
163-
echo "docker commit $did gridappsd/blazegraph:${TIMESTAMP}_${GITHASH}_models "
164-
docker commit $did gridappsd/blazegraph:${TIMESTAMP}_${GITHASH}_models
165-
echo " "
166-
167-
# load the measurements
168-
echo " "
169-
echo "Loading the measurements"
170-
171-
echo " "
172-
echo "Modifying the Powergrid-Models/Meas/constants.py file for loading data into local docker container"
173-
sed -i'.bak' -e 's/^blazegraph_url.*$/blazegraph_url = \"http:\/\/localhost:8889\/bigdata\/sparql\"/' Powergrid-Models/Meas/constants.py
174-
175-
cd Powergrid-Models/Meas
176-
if [ ! -d tmp ]; then
177-
mkdir tmp
178-
else
179-
rm tmp/*txt 2> /dev/null
167+
if [ ! -f cimhubconfig.json ]; then
168+
cp cimhubdocker.json cimhubconfig.json
180169
fi
181-
cd tmp
182-
183-
echo " "
184-
echo "Generating measurements files"
185-
python3 ../ListFeeders.py | grep -v 'binding keys' | while read line; do
186-
echo " Generating measurements files for $line"
187-
python3 ../ListMeasureables.py $line
188-
done
189-
190-
echo " "
191-
echo "Measurements found"
192-
#shasum * | shasum | cut -d' ' -f1
193-
wc -l *txt | grep total | awk '{print $1}'
194170

195-
echo " "
196-
echo "Loading measurements files"
197-
ls -1 *txt | xargs -P 12 -n 1 -I, bash -c 'echo " Loading measurments file ,";python3 ../InsertMeasurements.py ,'
198-
199-
echo " "
200-
rangeCount=`curl -s -G -H 'Accept: application/xml' "${url_blazegraph}sparql" --data-urlencode ESTCARD | sed 's/.*rangeCount=\"\([0-9]*\)\".*/\1/'`
201-
echo "Finished loading blazegraph measurements ($rangeCount)"
202-
echo " "
203-
echo "docker commit $did gridappsd/blazegraph:${TIMESTAMP}_${GITHASH}_measurements "
204-
docker commit $did gridappsd/blazegraph:${TIMESTAMP}_${GITHASH}_measurements
205-
206-
cd ../../houses
207-
# assign random climate zones (1-5) to lookup
208-
zone_acep_psil=1
209-
zone_ieee123=2
210-
zone_ieee123pv=3
211-
zone_ieee13nodeckt=4
212-
zone_ieee13nodecktassets=5
213-
zone_ieee8500=3
214-
zone_ieee8500new_335=4
215-
zone_j1=1
216-
zone_sourceckt=2
217-
218-
echo " "
219-
echo "Loading houses"
220-
python3 ../Meas/ListFeeders.py | grep -v 'binding keys' | while read fdrname fdrid ; do
221-
# use lookup
222-
climate_zone="zone_$fdrname"
223-
echo " Loading houses for $fdrname : $fdrid : ${!climate_zone}"
224-
python3 insertHouses.py $fdrid ${!climate_zone}
225-
status=$?
226-
if [ $status -gt 0 ]; then
227-
echo " "
228-
echo " Failed loading houses for $fdrname: python3 insertHouses.py $fdrid ${!climate_zone}"
229-
echo " "
230-
fi
231-
done
171+
./import_all.sh
172+
status=$?
173+
echo "status: $status"
232174

233175
echo " "
234176
rangeCount=`curl -s -G -H 'Accept: application/xml' "${url_blazegraph}sparql" --data-urlencode ESTCARD | sed 's/.*rangeCount=\"\([0-9]*\)\".*/\1/'`
235177
echo "Finished loading blazegraph houses ($rangeCount)"
236178

237-
238179
echo " "
239180
echo "----"
240181
echo "docker commit $did gridappsd/blazegraph:${TIMESTAMP}_${GITHASH} "
@@ -244,7 +185,7 @@ docker stop $did
244185
echo " "
245186
echo "Run these commands to commit the container and push the container to dockerhub"
246187
echo "----"
247-
echo "docker tag gridappsd/blazegraph:${TIMESTAMP}_${GITHASH} gridappsd/blazegraph:develop"
188+
echo "docker tag gridappsd/blazegraph:${TIMESTAMP}_${GITHASH} gridappsd/blazegraph${GRIDAPPSD_TAG}"
248189
echo "docker push gridappsd/blazegraph:${TIMESTAMP}_${GITHASH}"
249190
echo "docker push gridappsd/blazegraph:develop"
250191

requirements_blazegraph.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
cimhub
2+
pandas<2.0
3+
pyparsing==3.0.8
4+
python-dateutil==2.8.2
5+
six==1.16.0
6+
SPARQLWrapper==2.0.0

0 commit comments

Comments
 (0)