Commit f6fa6351 authored by Pascal Meunier's avatar Pascal Meunier

find Python path on CentOS 7; changes in comments and DEBUG defaults to False.

parent 1ee9edcd
......@@ -30,12 +30,19 @@
# Common libraries are installed as owned by root so the client can't modify them, as root may need to use them
# find the highest Python version installed
ifeq (/usr/lib/python2.6,$(wildcard /usr/lib/python2.6))
ifeq (/usr/lib/python2.6/site-packages,$(wildcard /usr/lib/python2.6/site-packages))
export MOD_HUBZERO=/usr/lib/python2.6/site-packages/hubzero
endif
ifeq (/usr/lib/python2.7,$(wildcard /usr/lib/python2.7))
ifeq (/usr/lib/python2.7/site-packages,$(wildcard /usr/lib/python2.7/site-packages))
export MOD_HUBZERO=/usr/lib/python2.7/site-packages/hubzero
endif
ifeq (/usr/lib/python2.7/dist-packages,$(wildcard /usr/lib/python2.7/dist-packages))
export MOD_HUBZERO=/usr/lib/python2.7/dist-packages/hubzero
endif
ifndef MOD_HUBZERO
echo Python package installation directory not found.
exit 1
endif
export MOD_INSTDIR=$(MOD_HUBZERO)/mw
# Does www-data or apache exist?
......@@ -93,12 +100,12 @@ install:
install --mode 0644 -D vnc_pass.py $(INSTDIR)/vnc_pass.py
install --mode 0644 -D zone.py $(INSTDIR)/zone.py
docker_install: install
# The differences between xyz.py and xyz_tr.py files should be in the use of database transactions only
# such implementation details should be entirely encapsulated by the classes
dbtransaction_install: install
install --mode 0644 -D display_tr.py $(INSTDIR)/display.py
install --mode 0644 -D session_tr.py $(INSTDIR)/session.py
aws_install: docker_install
manual_install: install
rm -f $(INSTDIR)/*.pyc $(INSTDIR)/*.pyo
python -m compileall $(INSTDIR)/
......@@ -108,8 +115,7 @@ manual_install: install
# this is needed for manual installation success in the absence of package hubzero-python
if ! [ -f $(DESTDIR)/$(MOD_HUBZERO)/__init__.py ]; then touch $(DESTDIR)/$(MOD_HUBZERO)/__init__.py; fi
manual_docker_install: docker_install manual_install
manual_aws_install: aws_install manual_install
manual_dbtransaction_install: dbtransaction_install manual_install
uninstall:
rm -rf $(INSTDIR)/*
......
......@@ -51,9 +51,9 @@ class Display:
A display
Display states:
'starting': the container hasn't finished starting yet
'used': the container on the execution host is running a tool
'ready': there should be a matching container on the execution host
'broken': don't use that container, something went wrong
'used': the container on the execution host is running a tool
'ready': there should be a matching container on the execution host
'broken': don't use that container, something went wrong
'absent': there is no container running
'stopping': the container hasn't finished stopping yet -- note that session may have been deleted already (zombie check)
......@@ -66,17 +66,18 @@ class Display:
stopping => broken, absent, or ready if Windows
invariant: session must exist for displays in state starting, used; otherwise delete_zombie will harvest
invariant (needs to be checked?): container must exist on execution host for displays in states ready, starting, used
"""
def __init__(self, host, dispnum, vncpass):
def __init__(self, host, dispnum, vncpass, status = ''):
"""host + dispnum is unique"""
self.host = host # a host object
self.dispnum = int(dispnum) # an integer
self.vncpass = vncpass # a string
self.sessnum = 0
self.status = ''
self.status = status
def __set_status(self, db, status, sessnum=None):
"""Update host usage count after changing the status of a display, using db lock or transactions
This is because decisions are made in other threads based on the usage count"""
self.status = status
if VERBOSE:
log("VERBOSE: setting status of display %d on host %s to %s" % (self.dispnum, self.host.hostname, status))
......@@ -101,8 +102,8 @@ class Display:
def ready(self, db):
"""
starting => ready
used => ready if session start aborted
starting => ready
used => ready if session start aborted
"""
if self.status == "broken":
return
......
......@@ -44,7 +44,7 @@ from support import genpasswd
from log import log
from host import Host
DEBUG = True
DEBUG = False
class Display:
"""Is used on web servers only, not on execution hosts.
displays and containers refer to the same thing, but displays are from the perspective of the
......@@ -52,10 +52,10 @@ class Display:
A display
Display states:
'starting': the container hasn't finished starting yet
'used': the container on the execution host is running a tool
'ready': there should be a matching container on the execution host
'broken': don't use that container, something went wrong
'absent' : there is no container running
'used': the container on the execution host is running a tool
'ready': there should be a matching container on the execution host
'broken': don't use that container, something went wrong
'absent': there is no container running
'stopping': the container hasn't finished stopping yet -- note that session may have been deleted already (zombie check)
......@@ -67,8 +67,6 @@ class Display:
stopping => broken, absent, or ready if Windows
invariant: session must exist for displays in state starting, used; otherwise delete_zombie will harvest
invariant (needs to be checked?): container must exist on execution host for displays in states ready, starting, used
Removed functionality: Windows containers are never destroyed, and instead should go from stopping => ready
"""
def __init__(self, host, dispnum, vncpass, status = ''):
"""host + dispnum is unique"""
......@@ -79,7 +77,7 @@ class Display:
self.status = status
def __set_status(self, db, status, sessnum=None):
"""Update host usage count after changing the status of a display, all wrapped in a transaction.
"""Update host usage count after changing the status of a display, using db lock or transactions
This is because decisions are made in other threads based on the usage count"""
self.status = status
if VERBOSE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment