Skip to content

Commit

Permalink
Merge pull request #65 from lsst-camera-dh/ETCCB-525
Browse files Browse the repository at this point in the history
ETCCB-525:  python 3 support, BOT simulation code; multi-acq raft harnessed jobs
  • Loading branch information
jchiang87 authored Oct 22, 2018
2 parents 5de1f2c + 0a8eaac commit 0ddd980
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
35 changes: 21 additions & 14 deletions bin/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
import shutil
import subprocess
import warnings
import ConfigParser
try:
import ConfigParser as configparser
except ImportError:
import configparser

class Parfile(dict):
def __init__(self, infile, section):
super(Parfile, self).__init__()
parser = ConfigParser.ConfigParser()
parser = configparser.ConfigParser()
parser.optionxform = str
parser.read(infile)
for key, value in parser.items(section):
Expand All @@ -32,13 +35,14 @@ class Installer(object):
_executable = '/bin/bash'
_github_org = 'https://github.com/lsst-camera-dh'
_github_elec_org = 'https://github.com/lsst-camera-electronics'
def __init__(self, version_file, inst_dir='.',
def __init__(self, version_file, inst_dir='.', python_exec='python',
hj_folders=('BNL_T03',), site='BNL'):
self.version_file = os.path.abspath(version_file)
if inst_dir is not None:
self.inst_dir = os.path.abspath(inst_dir)
shutil.copy(self.version_file,
os.path.join(self.inst_dir, 'installed_versions.txt'))
self.python_exec = python_exec
self.hj_folders = hj_folders
self.site = site
self._package_dirs = None
Expand All @@ -47,7 +51,7 @@ def __init__(self, version_file, inst_dir='.',
self.curdir = os.path.abspath('.')
try:
self.pars = Parfile(self.version_file, 'jh')
except ConfigParser.NoSectionError:
except configparser.NoSectionError:
pass

def modules_install(self):
Expand Down Expand Up @@ -96,7 +100,8 @@ def lcatr_install(self, package_name):
version = self.pars[package_name]
self.github_download(package_name, version)
inst_dir = self.inst_dir
command = "cd %(package_name)s-%(version)s/; python setup.py install --prefix=%(inst_dir)s" % locals()
python_exec = self.python_exec
command = "cd %(package_name)s-%(version)s/; %(python_exec)s setup.py install --prefix=%(inst_dir)s" % locals()
subprocess.call(command, shell=True, executable=self._executable)

@property
Expand All @@ -109,7 +114,7 @@ def package_dirs(self):
package_dir = "%(package)s-%(version)s" % locals()
self._package_dirs[package] = os.path.join(self.inst_dir,
package_dir)
except ConfigParser.NoSectionError:
except configparser.NoSectionError:
pass
return self._package_dirs

Expand All @@ -119,7 +124,7 @@ def stack_dir(self):
try:
pars = Parfile(self.version_file, 'dmstack')
self._stack_dir = pars['stack_dir']
except ConfigParser.NoSectionError:
except configparser.NoSectionError:
pass
return self._stack_dir

Expand All @@ -128,7 +133,7 @@ def datacat_pars(self):
if self._datacat_pars is None:
try:
self._datacat_pars = Parfile(self.version_file, 'datacat')
except ConfigParser.NoSectionError:
except configparser.NoSectionError:
pass
return self._datacat_pars

Expand All @@ -154,7 +159,7 @@ def write_setup(self):
def _eups_config(self):
try:
pars = Parfile(self.version_file, 'eups_packages')
except ConfigParser.NoSectionError:
except configparser.NoSectionError:
return ''
return '\n'.join(['setup %s' % package for package in pars]) + '\n'

Expand Down Expand Up @@ -240,7 +245,7 @@ def jh(self):
def eups_package_installer(self):
try:
pars = Parfile(self.version_file, 'eups_packages')
except ConfigParser.NoSectionError:
except configparser.NoSectionError:
return
inst_dir = self.inst_dir
stack_dir = self.stack_dir.rstrip(os.path.sep)
Expand All @@ -255,7 +260,7 @@ def eups_package_installer(self):
def package_installer(self):
try:
pars = Parfile(self.version_file, 'packages')
except ConfigParser.NoSectionError:
except configparser.NoSectionError:
return
inst_dir = self.inst_dir
for package, version in pars.items():
Expand All @@ -276,7 +281,7 @@ def jh_test(self):
command = 'source ./setup.sh; python harnessed-jobs-%(hj_version)s/tests/setup_test.py' % locals()
subprocess.call(command, shell=True, executable=self._executable)
os.chdir(self.curdir)
except (ConfigParser.NoSectionError, KeyError):
except (configparser.NoSectionError, KeyError):
pass

def _ccs_download(self, package_name, package_version):
Expand Down Expand Up @@ -376,7 +381,7 @@ def ccs(self, args, section='ccs'):
self.ccs_symlink("update.py", os.path.abspath(os.path.join(self.curdir,__file__)))
try:
pars = Parfile(self.version_file, section)
except ConfigParser.NoSectionError:
except configparser.NoSectionError:
return

# Loop over the content of the [ccs] section to find either
Expand Down Expand Up @@ -426,6 +431,7 @@ def ccs(self, args, section='ccs'):
parser.add_argument('--site', type=str, default='SLAC',
help='Site (SLAC, BNL, etc.)')
parser.add_argument('--hj_folders', type=str, default="SLAC")
parser.add_argument('--python_exec', type=str, default='python')
parser.add_argument('--ccs_inst_dir', type=str, default=None)
parser.add_argument('--dev', action='store_true')

Expand All @@ -440,11 +446,12 @@ def ccs(self, args, section='ccs'):
args = parser.parse_args(installerArguments)

installer = Installer(args.version_file, inst_dir=args.inst_dir,
python_exec=args.python_exec,
hj_folders=args.hj_folders.split(), site=args.site)

if args.inst_dir is not None:
installer.jh()
installer.jh_test()
#installer.jh_test()

if args.ccs_inst_dir is not None:
installer.ccs(args)
20 changes: 10 additions & 10 deletions packageLists/IR2_JH_versions.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[jh]
harnessed-jobs = 0.4.66
lcatr-harness = 0.15.1
lcatr-schema = 0.5.2
lcatr-modulefiles = 0.3.1
lcatr-harness = 0.16.0
lcatr-schema = 0.6.0
lcatr-modulefiles = 0.4.0

[eups_packages]
eotest = 0.0.31
eotest = 0.1.0

[packages]
eTraveler-clientAPI = 1.7.1
metrology-data-analysis = 0.0.14
camera-model = 0.0.7
camera-model = 0.1.1
config_files = 0.0.12
jh-ccs-utils = 0.0.11
IandT-jobs = 0.1.8
jh-dev-tools = 0.0.1
EO-analysis-jobs = 0.0.12
jh-ccs-utils = 0.1.1
IandT-jobs = 0.1.9
jh-dev-tools = 0.1.0
EO-analysis-jobs = 0.1.0

[dmstack]
stack_dir = /lsst/dh/software/centos7-gcc48/anaconda/py-2.7/envs/v12_0
stack_dir = /lsst/dh/software/centos7-gcc48/stack/v16_py3

[datacat]
datacatdir = /lsst/dh/software/centos7-gcc48/dev/datacat/0.4
Expand Down

0 comments on commit 0ddd980

Please sign in to comment.