Skip to content

Commit 1dcd35e

Browse files
authored
Merge pull request #133 from pnnl/develop
Develop
2 parents 480ce11 + 53d6b6b commit 1dcd35e

File tree

16 files changed

+232
-56
lines changed

16 files changed

+232
-56
lines changed

scripts/build/stamp.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ if [[ -z ${INSTDIR} ]]; then
44
. "${HOME}/tespEnv"
55
fi
66

7-
ver="1.3.3"
7+
ver="1.3.5"
88

99
echo
1010
echo "Stamping TESP $ver, if you want to change the version, edit this file."

scripts/build/tesp_pypi.id

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ tables 3.8.0
210210
tabulate 0.9.0
211211
tenacity 8.2.3
212212
termcolor 2.3.0
213-
tesp-support 1.3.2 /home/tesp/tesp/repository/tesp/src/tesp_support
213+
tesp-support 1.3.5 /home/tesp/tesp/repository/tesp/src/tesp_support
214214
text-unidecode 1.3
215215
threadpoolctl 3.2.0
216216
tomli 2.0.1

scripts/docker/Dockerfile.eplus

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ FROM tesp-helics:latest AS tesp-run
44
# TESP user name and work directory
55
ENV USER_NAME=worker
66
ENV USER_HOME=/home/$USER_NAME
7-
ENV TESPDIR=${USER_HOME}/tesp
8-
ENV INSTDIR=${TESPDIR}/tenv
7+
ENV TESPDIR=$USER_HOME/tesp
8+
ENV INSTDIR=$TESPDIR/tenv
99

1010
# PATH
1111
ENV PATH=$PATH:$INSTDIR/energyplus

scripts/docker/Dockerfile.fncs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Delcare arguments
1+
# Declare arguments
22
ARG UBUNTU=ubuntu
33
ARG UBUNTU_VERSION=:20.04
44

@@ -8,8 +8,8 @@ FROM ${UBUNTU}${UBUNTU_VERSION} AS tesp-run
88
# TESP user name and work directory
99
ENV USER_NAME=worker
1010
ENV USER_HOME=/home/$USER_NAME
11-
ENV TESPDIR=${USER_HOME}/tesp
12-
ENV INSTDIR=${TESPDIR}/tenv
11+
ENV TESPDIR=$USER_HOME/tesp
12+
ENV INSTDIR=$TESPDIR/tenv
1313

1414
# Compile exports
1515
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64

scripts/docker/Dockerfile.gridlabd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ FROM tesp-helics:latest AS tesp-run
44
# TESP user name and work directory
55
ENV USER_NAME=worker
66
ENV USER_HOME=/home/$USER_NAME
7-
ENV TESPDIR=${USER_HOME}/tesp
8-
ENV INSTDIR=${TESPDIR}/tenv
7+
ENV TESPDIR=$USER_HOME/tesp
8+
ENV INSTDIR=$TESPDIR/tenv
99

1010
# Compile exports
1111
ENV GLPATH=$INSTDIR/lib/gridlabd:$INSTDIR/share/gridlabd

scripts/docker/Dockerfile.helics

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Delcare arguments
1+
# Declare arguments
22
ARG UBUNTU=ubuntu
33
ARG UBUNTU_VERSION=:20.04
44

@@ -8,8 +8,8 @@ FROM ${UBUNTU}${UBUNTU_VERSION} AS tesp-run
88
# TESP user name and work directory
99
ENV USER_NAME=worker
1010
ENV USER_HOME=/home/$USER_NAME
11-
ENV TESPDIR=${USER_HOME}/tesp
12-
ENV INSTDIR=${TESPDIR}/tenv
11+
ENV TESPDIR=$USER_HOME/tesp
12+
ENV INSTDIR=$TESPDIR/tenv
1313

1414
# Compile exports
1515
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64

scripts/docker/Dockerfile.ns3

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ FROM tesp-helics:latest AS tesp-run
44
# TESP user name and work directory
55
ENV USER_NAME=worker
66
ENV USER_HOME=/home/$USER_NAME
7-
ENV TESPDIR=${USER_HOME}/tesp
8-
ENV INSTDIR=${TESPDIR}/tenv
7+
ENV TESPDIR=$USER_HOME/tesp
8+
ENV INSTDIR=$TESPDIR/tenv
99

1010
# Copy Binaries
1111
# COPY --from=tesp-build:latest $INSTDIR/ $INSTDIR/

scripts/docker/Dockerfile.python

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ FROM tesp-helics:latest AS tesp-run
44
# TESP user name and work directory
55
ENV USER_NAME=worker
66
ENV USER_HOME=/home/$USER_NAME
7-
ENV TESPDIR=${USER_HOME}/tesp
8-
ENV INSTDIR=${TESPDIR}/tenv
7+
ENV TESPDIR=$USER_HOME/tesp
8+
ENV INSTDIR=$TESPDIR/tenv
99

1010
# Copy Binaries
1111
# COPY --from=tesp-build:latest $INSTDIR/ $INSTDIR/

scripts/docker/Dockerfile.tespapi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ FROM tesp-python:latest AS tesp-run
44
# TESP user name and work directory
55
ENV USER_NAME=worker
66
ENV USER_HOME=/home/$USER_NAME
7-
ENV TESPDIR=${USER_HOME}/tesp
8-
ENV INSTDIR=${TESPDIR}/tenv
7+
ENV TESPDIR=$USER_HOME/tesp
8+
ENV INSTDIR=$TESPDIR/tenv
99

1010
# Copy Binaries
1111
# COPY --from=tesp-build:latest $INSTDIR/ $INSTDIR/
@@ -14,7 +14,7 @@ COPY --from=tesp-build:latest $TESPDIR/data/ $TESPDIR/data/
1414
COPY --from=tesp-build:latest $TESPDIR/repository/AMES-V5.0/README.rst $TESPDIR
1515
COPY --from=tesp-build:latest $TESPDIR/repository/AMES-V5.0/psst/ $TESPDIR/psst/
1616

17-
RUN echo "===== BUILD RUN TESPAPI =====" && \
17+
RUN echo "===== BUILD RUN TESP API =====" && \
1818
export DEBIAN_FRONTEND=noninteractive && \
1919
export DEBCONF_NONINTERACTIVE_SEEN=true && \
2020
echo "===== Install Libraries =====" && \

scripts/tespEnv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
. $HOME/tesp/venv/bin/activate
1+
. $HOME/.tvenv/bin/activate
22

33
# TESP exports
44
export TESPDIR=$HOME/tesp
5-
export INSTDIR=$HOME/tesp/tenv
6-
export REPODIR=$HOME/tesp/repository
5+
export INSTDIR=$TESPDIR/tenv
6+
export REPODIR=$TESPDIR/repository
77
export TESPBUILD=$TESPDIR/scripts/build
88
export TESPHELPR=$TESPDIR/scripts/helpers
99

scripts/tespInstall.sh

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/bin/bash
2+
3+
echo
4+
echo "Install git and python, must be installed for other components"
5+
sudo apt-get -y upgrade
6+
sudo apt-get -y install git python3-venv python3-pip python3-tk python3-pil.imagetk
7+
8+
echo
9+
if [[ -z $1 && -z $2 ]]; then
10+
echo "No user name set for git repositories!"
11+
else
12+
git config --global user.name "$1"
13+
git config --global user.email "$2"
14+
echo "User .name=$1 and .email=$2 have been set for git repositories!"
15+
fi
16+
git config --global credential.helper store
17+
18+
echo
19+
if [[ -z $3 ]]; then
20+
WORKDIR=$HOME/tesp
21+
else
22+
WORKDIR=$HOME/$3
23+
fi
24+
echo "Install TESP home directory"
25+
echo "TESP home dirctory is $WORKDIR"
26+
27+
cat > "$HOME/tespEnv" << EOF
28+
. $HOME/.tvenv/bin/activate
29+
30+
# TESP exports
31+
export TESPDIR=$WORKDIR
32+
export INSTDIR=\$TESPDIR/tenv
33+
export REPODIR=\$TESPDIR/repository
34+
export TESPBUILD=\$TESPDIR/scripts/build
35+
export TESPHELPR=\$TESPDIR/scripts/helpers
36+
37+
# COMPILE exports
38+
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
39+
export PYHELICS_INSTALL=\$INSTDIR
40+
export GLPATH=\$INSTDIR/lib/gridlabd:\$INSTDIR/share/gridlabd
41+
export CPLUS_INCLUDE_PATH=/usr/include/hdf5/serial:\$INSTDIR/include
42+
export FNCS_INCLUDE_DIR=\$INSTDIR/include
43+
export FNCS_LIBRARY=\$INSTDIR/lib
44+
export LD_LIBRARY_PATH=\$INSTDIR/lib
45+
export LD_RUN_PATH=\$INSTDIR/lib
46+
# export BENCH_PROFILE=1
47+
48+
# PATH
49+
export PATH=\$INSTDIR/bin:\$PATH
50+
export PATH=\$JAVA_HOME:\$PATH
51+
export PATH=\$PATH:\$INSTDIR/energyplus
52+
export PATH=\$PATH:\$INSTDIR/energyplus/PreProcess
53+
export PATH=\$PATH:\$INSTDIR/energyplus/PostProcess
54+
export PATH=\$PATH:\$TESPHELPR
55+
56+
# PSST environment variables
57+
export PSST_SOLVER=cbc
58+
# 'PSST_SOLVER path' -- one of "cbc", "ipopt", "/ibm/cplex/bin/x86-64_linux/cplexamp"
59+
export PSST_WARNING=ignore
60+
# 'PSST_WARNING action' -- one of "error", "ignore", "always", "default", "module", or "once"
61+
62+
# PROXY export if needed
63+
# export HTTPS_PROXY=http://proxy01.pnl.gov:3128
64+
EOF
65+
66+
echo
67+
echo "Install a virtual python environment to $HOME/.tvenv"
68+
python3 -m pip install --upgrade pip
69+
python3 -m pip install virtualenv
70+
python3 -m venv "$HOME/.tvenv" --prompt TESP
71+
72+
source "$HOME/tespEnv"
73+
74+
echo "Installing Python Libraries..."
75+
which python > "$HOME/tesp.log" 2>&1
76+
pip install --upgrade pip >> "$HOME/tesp.log" 2>&1
77+
78+
echo "Installing TESP empty repo..."
79+
git clone --no-checkout https://github.com/pnnl/tesp "$TESPDIR"
80+
cd "$TESPDIR" || exit
81+
82+
echo "Installing Python Libraries..."
83+
git checkout HEAD requirements.txt
84+
pip install -r "$TESPDIR/requirements.txt" >> "$HOME/tesp.log" 2>&1
85+
86+
echo "Installing Python TESP API..."
87+
pip install tesp_support >> "$HOME/tesp.log" 2>&1
88+

scripts/tespPip.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
git checkout HEAD requirements.txt
4+
pip install -r "$HOME/tesp/requirements.txt" >> "$HOME/tesp.log"
5+
6+
if [[ -z $VIRTUAL_ENV ]]; then
7+
VIRTUAL=""
8+
else
9+
VIRTUAL=$VIRTUAL_ENV/bin/activate
10+
fi
11+
12+
cat >> "$HOME/tespEnv" << EOF
13+
$VIRTUAL
14+
15+
# TESP exports
16+
export TESPDIR=$HOME/tesp
17+
export INSTDIR=\$TESPDIR/tenv
18+
export REPODIR=\$TESPDIR/repository
19+
export TESPBUILD=\$TESPDIR/scripts/build
20+
export TESPHELPR=\$TESPDIR/scripts/helpers
21+
22+
# COMPILE exports
23+
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
24+
export PYHELICS_INSTALL=\$INSTDIR
25+
export GLPATH=\$INSTDIR/lib/gridlabd:\$INSTDIR/share/gridlabd
26+
export CPLUS_INCLUDE_PATH=/usr/include/hdf5/serial:\$INSTDIR/include
27+
export FNCS_INCLUDE_DIR=\$INSTDIR/include
28+
export FNCS_LIBRARY=\$INSTDIR/lib
29+
export LD_LIBRARY_PATH=\$INSTDIR/lib
30+
export LD_RUN_PATH=\$INSTDIR/lib
31+
# export BENCH_PROFILE=1
32+
33+
# PATH
34+
export PATH=\$INSTDIR/bin:\$PATH
35+
export PATH=\$JAVA_HOME:\$PATH
36+
export PATH=\$PATH:\$INSTDIR/energyplus
37+
export PATH=\$PATH:\$INSTDIR/energyplus/PreProcess
38+
export PATH=\$PATH:\$INSTDIR/energyplus/PostProcess
39+
export PATH=\$PATH:\$TESPHELPR
40+
41+
# PSST environment variables
42+
export PSST_SOLVER=cbc
43+
# 'PSST_SOLVER path' -- one of "cbc", "ipopt", "/ibm/cplex/bin/x86-64_linux/cplexamp"
44+
export PSST_WARNING=ignore
45+
# 'PSST_WARNING action' -- one of "error", "ignore", "always", "default", "module", or "once"
46+
47+
# PROXY export if needed
48+
# export HTTPS_PROXY=http://proxy01.pnl.gov:3128
49+
EOF

scripts/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.3
1+
1.3.5

src/tesp_support/tesp_support/api/data.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""Path and Data functions for use within tesp_support.
44
"""
55

6-
from os import path, chdir, mkdir, environ
6+
from os import path, chdir, environ
77
from importlib_resources import files
88
import argparse
99
import subprocess
@@ -34,6 +34,8 @@
3434

3535
# uncomment for debug
3636
# tesp_path = path.expanduser('~') + '/tesp'
37+
# chdir(tesp_path)
38+
# tesp_path = path.expanduser('~') + '/tesp/tesp'
3739

3840
if path.isdir(tesp_path):
3941
for _dir in components:
@@ -47,11 +49,17 @@
4749
else:
4850
# New instance
4951
try:
50-
mkdir(tesp_path)
51-
# print("Writing the TESP setting config file -> " + tesp_path)
52-
# make_settings(tesp_path)
52+
chdir(path.expanduser('~'))
53+
cmd = 'git clone --no-checkout https://github.com/pnnl/tesp'
54+
subprocess.Popen(cmd, shell=True).wait()
55+
chdir(tesp_path)
56+
cmd = 'git checkout HEAD scripts/tespPip.sh'
57+
subprocess.Popen(cmd, shell=True).wait()
58+
chdir('scripts')
59+
cmd = './tespPip.sh'
60+
subprocess.Popen(cmd, shell=True).wait()
5361
except FileExistsError:
54-
print("Can NOT write the TESP setting config file -> " + tesp_path)
62+
print("Can NOT write the TESP configure files -> " + tesp_path)
5563
pass
5664

5765

@@ -129,26 +137,21 @@ def tesp_component():
129137
if error:
130138
return
131139

132-
parcel = ["svn", "checkout", "https://github.com/pnnl/tesp/trunk/"]
133-
140+
parcel = ['git', 'checkout', 'HEAD']
134141
choice = int(args.component[0])
135142
if 9 > choice > 0:
136-
parcel[2] = parcel[2] + components[choice]
137-
print("Component ->", parcel[2])
143+
parcel.append(components[choice])
144+
print("Component ->", parcel[-1])
138145
else:
139146
print("Bad choice, choose 1 through 9")
140147
return
141148

142-
tmp = tesp_path + '/' + components[choice]
143-
if path.isdir(tmp):
144-
print("It seems we have a copy of " + tmp)
149+
component = tesp_path + '/' + components[choice]
150+
if path.isdir(component):
151+
print("It seems we have a copy of " + component)
145152
return
146153

147154
# can proceed with the copy
148155
chdir(tesp_path)
149-
p = subprocess.Popen(parcel, shell=False)
150-
p.wait()
151-
line = ["rm", "-rf", components[choice] + "/.svn"]
152-
p = subprocess.Popen(line, shell=False)
153-
p.wait()
156+
subprocess.Popen(parcel, shell=False).wait()
154157
print('Output directory: ', tesp_path + "/" + components[choice])

0 commit comments

Comments
 (0)