Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Network
Browse files Browse the repository at this point in the history
  • Loading branch information
wxh06 committed Jun 25, 2020
1 parent 734e47f commit 029c866
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dockerjudge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
def judge(processor, source, tests, config=None,
client=docker.from_env()):
'Main function'
container = client.containers.run(processor.image, detach=True,
network_disabled=True, tty=True)
config = config or {}
container = client.containers.run(
processor.image, detach=True, tty=True,
network_disabled=not config.get('network')
)
try:
return run(container, processor, source, tests, config)
finally:
Expand Down Expand Up @@ -67,7 +70,6 @@ def judge_test_cases(container, processor, tests, config):

def run(container, processor, source, tests, config=None):
'Compile and judge'
config = config or {}
config.setdefault('callback', {})
exec_result = compile_source_code(container, processor, source, config)
if exec_result.exit_code:
Expand Down

0 comments on commit 029c866

Please sign in to comment.