Skip to content

Commit 3f7f9d2

Browse files
authored
fix: fix codejail proxy (#151)
1 parent 2c66dde commit 3f7f9d2

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

codejail/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""init"""
22

3-
__version__ = '3.3.1'
3+
__version__ = '3.3.2'

codejail/proxy.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,19 @@ def get_proxy():
111111

112112
# If we need a proxy, make a proxy.
113113
if PROXY_PROCESS is None:
114-
# Start the proxy by invoking proxy_main.py in our root directory.
115-
root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
116-
proxy_main_py = os.path.join(root, "proxy_main.py")
117-
118114
# Run proxy_main.py with the same Python that is running us. "-u" makes
119115
# the stdin and stdout unbuffered. We pass the log level of the
120116
# "codejail" log so that the proxy can send back an appropriate level
121117
# of detail in the log messages.
122118
log_level = log.getEffectiveLevel()
123-
cmd = [sys.executable, '-u', proxy_main_py, str(log_level)]
119+
cmd = [sys.executable, '-u', '-m', "codejail.proxy_main", str(log_level)]
124120

125121
PROXY_PROCESS = subprocess.Popen(
126122
args=cmd,
127123
stdin=subprocess.PIPE,
128124
stdout=subprocess.PIPE,
129125
stderr=subprocess.STDOUT,
130-
)
126+
)
131127
log.info("Started CodeJail proxy process (pid %d)", PROXY_PROCESS.pid)
132128

133129
return PROXY_PROCESS

proxy_main.py renamed to codejail/proxy_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import sys
44

5-
from codejail.proxy import proxy_main
5+
from .proxy import proxy_main
66

77
if __name__ == "__main__":
88
sys.exit(proxy_main(sys.argv))

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def get_version(*file_paths):
3636
author='edX',
3737
author_email="[email protected]",
3838
url='https://github.com/openedx/codejail',
39-
scripts=['proxy_main.py', 'memory_stress.py'],
39+
scripts=['memory_stress.py'],
4040
packages=find_packages(
4141
include=['codejail', 'codejail.*'],
4242
exclude=["*tests"],

0 commit comments

Comments
 (0)