Skip to content

Commit

Permalink
Update sandbox_checker.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartManoj committed Jan 13, 2025
1 parent 714ea77 commit 6be5e00
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions sandbox_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,27 @@ def run(command):
}


def execute_action(data):
def read_file(path):
return {
'action': {
'action': 'read',
'args': {'path': path},
}
}

def execute_action(data, timeout=5):
data = json.dumps(data)
for timeout in [600,]:
for k in [1, 2]:
try:
response = requests.post(
f'http://localhost:{sandbox_port}/execute_action', data=data, timeout=timeout
)
print(response.json()['content'].replace('\r', ''))
url = f'http://localhost:{sandbox_port}/execute_action'
response = requests.post(url, data=data, timeout=timeout)
rj = response.json()
print(rj['content'].replace('\r', ''))
if rj.get('suffix'):
print(rj['suffix'])
break
except requests.exceptions.Timeout:
if timeout == 2:
if k == 2:
print('Timeout')
# sleep(1)
pass
Expand Down Expand Up @@ -67,3 +77,4 @@ def execute_action(data):
)
# execute_action(run_ipython('open_file'))
execute_action(run('pwd'))
execute_action(read_file('.openhands_instructions'))

0 comments on commit 6be5e00

Please sign in to comment.