Skip to content

Commit

Permalink
fix: fix codejail proxy (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
aht007 authored Feb 1, 2023
1 parent 2c66dde commit 3f7f9d2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion codejail/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""init"""

__version__ = '3.3.1'
__version__ = '3.3.2'
8 changes: 2 additions & 6 deletions codejail/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,19 @@ def get_proxy():

# If we need a proxy, make a proxy.
if PROXY_PROCESS is None:
# Start the proxy by invoking proxy_main.py in our root directory.
root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
proxy_main_py = os.path.join(root, "proxy_main.py")

# Run proxy_main.py with the same Python that is running us. "-u" makes
# the stdin and stdout unbuffered. We pass the log level of the
# "codejail" log so that the proxy can send back an appropriate level
# of detail in the log messages.
log_level = log.getEffectiveLevel()
cmd = [sys.executable, '-u', proxy_main_py, str(log_level)]
cmd = [sys.executable, '-u', '-m', "codejail.proxy_main", str(log_level)]

PROXY_PROCESS = subprocess.Popen(
args=cmd,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
)
log.info("Started CodeJail proxy process (pid %d)", PROXY_PROCESS.pid)

return PROXY_PROCESS
Expand Down
2 changes: 1 addition & 1 deletion proxy_main.py → codejail/proxy_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sys

from codejail.proxy import proxy_main
from .proxy import proxy_main

if __name__ == "__main__":
sys.exit(proxy_main(sys.argv))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_version(*file_paths):
author='edX',
author_email="[email protected]",
url='https:/openedx/codejail',
scripts=['proxy_main.py', 'memory_stress.py'],
scripts=['memory_stress.py'],
packages=find_packages(
include=['codejail', 'codejail.*'],
exclude=["*tests"],
Expand Down

0 comments on commit 3f7f9d2

Please sign in to comment.