Remove manual testing suite for task_nursery
@@ -311,55 +311,3 @@ def fetch_log(host: Hostname, user: Username, task_id: int, tail: bool = False)
if output[host].exit_code != 0:
raise ExitCodeError(path)
return output[host].stdout, path
-
-
-if __name__ == '__main__':
- # Quick testing: python -m tensorhive.core.task_nursery
- # FIXME Mock: Received data digested by API controller
- # user = '155136mm'
- # pkey_path = '~/.ssh/id_rsa' # storage for public and private keys, common for all users
- # tasks = [
- # Task('galileo.eti.pg.gda.pl', 'sleep 20; echo $USER'),
- # Task('galileo.eti.pg.gda.pl', 'sleep 20; echo b'),
- # Task('galileo.eti.pg.gda.pl', 'sleep 20; echo c'),
- # Task('galileo.eti.pg.gda.pl', 'sleep 20; echo d')
- # ]
- # config = ssh.build_dedicated_config_for('galileo.eti.pg.gda.pl', user)
- # client = ssh.get_client(config)
- # [task.spawn(client) for task in tasks]
-
- user = 'bwroblew'
- host = 'ai.eti.pg.gda.pl'
- 'cd ~/Simulators/095; DISPLAY= ./CarlaUE4.sh Town04'
- import os
- while True:
- print('''
-Select action:
-1) List active TH screen sessions pids (no database)
-2) Spawn command
-3) Interrupt task with pid
-4) Kill all screen sessions
-Any other key to clear console
- ''')
- action = input()[0]
- if action == '1':
- print(running(host, user))
- elif action == '2':
- cmd = input('Command > ')
- pid = spawn(cmd, host, user)
- print('Spawned with PID: ', pid)
- elif action == '3':
- pid = input('PID > ')
- exit_code = terminate(pid, host, user, gracefully=True)
- print('Interruption exit_code: ', exit_code)
- elif action == '4':
- running_tasks = running(host, user)
- if not running_tasks:
- print('No running tasks')
- for task in running_tasks:
- print('Terminating: ', task)
- exit_code = terminate(task, host, user)
- print('Kill exit_code: ', exit_code)
- else:
- os.system('clear')
- continue
