def run(args, run_mode='local', storage_mode='local', dry_run=False): local_mount = mount.MountLocal( local_dir="/home/ashwin/Research/playground/softlearning", mount_point='/code', output=False) local_mount2 = mount.MountLocal(local_dir="/home/ashwin/.mujoco", mount_point='/root/.mujoco', output=False) # you can either run code on your machine or in the cloud if run_mode == 'local': launcher = mode.LocalMode() elif run_mode == 'ec2': launcher = mode.EC2Autoconfig( s3_bucket="doodad-ashwin-redone2", #s3_log_path='test_doodad/softlearning_test', s3_log_path='softlearning_exps/', instance_type='c4.large', spot_price=0.03, region='us-west-1', ami_name='ami-874378e7', ) results_mount_point = '/root/ray_results' if storage_mode == 'local': output_mount = mount.MountLocal( local_dir="/home/ashwin/Research/results/", mount_point=results_mount_point, output=True) elif storage_mode == 's3': output_mount = mount.MountS3(s3_path='softlearning_output', mount_point=results_mount_point, output=True) mounts = [local_mount, local_mount2, output_mount] kwargs = { #'command': "cat /code/secret.txt > /root/ray_results/secret.txt", 'command': command(args.domain, args.environment, args.exp_name), 'cli_args': "", 'mode': launcher, 'mounts': mounts, 'verbose': True, 'docker_image': 'abhiguptaberk/softlearningashwin:latest' } print(kwargs) if not dry_run: launch_api.run_command(**kwargs)
def test_echo_args(self): launcher = mode.LocalMode() result = launch_api.run_command('echo', cli_args='--help', mode=launcher, return_output=True) self.assertEqual(result.strip(), '--help') result = launch_api.run_command('echo', cli_args='--help --help2', mode=launcher, return_output=True) self.assertEqual(result.strip(), '--help --help2')
def test_run_no_output(self): """Simple test to check for no errors """ launcher = mode.LocalMode() result = launch_api.run_command('echo hello123', mode=launcher, return_output=False)
def run(): ec2_mount = mount.MountS3(s3_path='secret_output', mount_point='/output') local_mount = mount.MountLocal(local_dir=TESTING_DIR, mount_point='/data', output=False) mounts = [local_mount, ec2_mount] launcher = mode.EC2Autoconfig( s3_bucket=S3_BUCKET, s3_log_path='test_doodad/gcp_test', instance_type='c4.large', spot_price=0.03, region='us-west-1', ami_name='ami-874378e7', ) launch_api.run_command(command='cat /data/secret.txt > /output/secret.txt', mode=launcher, mounts=mounts, verbose=True)
def run(): ec2_mount = mount.MountEC2(gcp_path='secret_output', mount_point='/output') local_mount = mount.MountLocal(local_dir=TESTING_DIR, mount_point='/data', output=False) mounts = [local_mount, ec2_mount] ec2_credentials launcher = mode.EC2Autoconfig( s3_bucket=S3_BUCKET, s3_log_path='test_doodad/gcp_test', instance_type='t3.nano', spot_price=0.02, region='us-west1', ami_name='ami-089408c670f3e10c0', ) launch_api.run_command(command='cat /data/secret.txt > /output/secret.txt', mode=launcher, mounts=mounts, verbose=True)
def test_run_command(self): launcher = mode.LocalMode() result = launch_api.run_command('echo hello123', mode=launcher, return_output=True) self.assertEqual(result.strip(), 'hello123')