Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring #21

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
62226cb
add and tested local singularity mode
vitchyr Jun 1, 2018
e8f4a5c
fix slurm singularity and use local files since singularity sees host…
vitchyr Jun 1, 2018
e629f9a
remove hard-coded debugging line
vitchyr Jun 1, 2018
a7f2b01
add configuration options for sbatch
vitchyr Jun 1, 2018
3b1b3e5
Merge pull request #10 from vitchyr/slurm-singularity
justinjfu Jun 1, 2018
b684ba0
Update LICENSE
justinjfu Jun 5, 2018
4b5d101
Support for launching multiple containers per ec2 instance
stevenlin1111 Jun 25, 2018
d807519
Support for launching multiple containers per ec2 instance
stevenlin1111 Jun 25, 2018
f061df8
Merge pull request #1 from stevenlin1111/multi_exp
vitchyr Jun 25, 2018
00bc8ad
remove exp_name clearing hack
vitchyr Jun 25, 2018
baa12c5
append the ec2 instance id to the stdout log
vitchyr Jun 26, 2018
8333525
Add swap to ec2
stevenlin1111 Jul 17, 2018
57e3373
Merge pull request #2 from stevenlin1111/multi_exp
vitchyr Jul 18, 2018
134793d
remove trailing slash before stdout.log
vitchyr Aug 7, 2018
32914b0
Merge branch 'master' of github.com:vitchyr/doodad
vitchyr Aug 22, 2018
f5e0939
Merge branch 'master' of https://github.com/justinjfu/doodad
vitchyr Aug 22, 2018
5f0303a
add mode that generates a script to launch slurm experiments
vitchyr Aug 25, 2018
537fd2d
Fixed typo
dineshj1 Sep 6, 2018
725a97a
Merge pull request #14 from dineshj1/patch-1
justinjfu Sep 6, 2018
2f041de
give option to skip wait in call_and_wait
vitchyr Sep 14, 2018
5332f36
Merge pull request #13 from vitchyr/script-slurm-singularity-mode-added
justinjfu Sep 15, 2018
8a46c23
WIP
stevenlin1111 Oct 3, 2018
7ef5153
Add gce script
stevenlin1111 Oct 3, 2018
390dc19
move skip_wait to init rather than launch_command
vitchyr Oct 30, 2018
c4863df
Merge branch 'upstream-master' into support-skip-wait2
vitchyr Oct 30, 2018
394c76e
move num_exps and swap_size to init
vitchyr Oct 30, 2018
76263e3
add mode that generates a script to launch slurm experiments
vitchyr Aug 25, 2018
adaec17
Periodic log sync
stevenlin1111 Oct 30, 2018
c8394f9
Merge branch 'master' of https://github.com/justinjfu/doodad into syn…
vitchyr Oct 30, 2018
e2ffde6
move mode-specific arguments to init/state
vitchyr Oct 30, 2018
b8f4e0f
use s3_path if there is only one exp
vitchyr Oct 30, 2018
eb8e11d
for num_exp=1, save stdout.log to exp-specific dir
vitchyr Oct 30, 2018
2a84950
Merge pull request #12 from vitchyr/multiple-runs
justinjfu Oct 30, 2018
ef8832a
Merge pull request #15 from vitchyr/support-skip-wait2
justinjfu Oct 30, 2018
1f6459a
Merge branch 'master' into fix-slurm-mode-launch
justinjfu Oct 30, 2018
89f653d
Merge pull request #17 from vitchyr/fix-slurm-mode-launch
justinjfu Oct 30, 2018
1d99d8d
Merge branch 'master' into sync-user-log
justinjfu Oct 30, 2018
a85a93a
Merge pull request #16 from vitchyr/sync-user-log
justinjfu Oct 30, 2018
eee12cb
WIP
stevenlin1111 Oct 8, 2018
4115548
Merge branch 'master', remote-tracking branch 'origin' into gcp
stevenlin1111 Nov 1, 2018
972402e
Add labels to instances
stevenlin1111 Nov 1, 2018
3bb86f6
fix typo
vitchyr Nov 3, 2018
36a19d1
Merge pull request #19 from vitchyr/fix-typo-in-stdout-output-log-path
justinjfu Nov 3, 2018
8226826
Merge pull request #18 from stevenlin1111/gcp
justinjfu Nov 3, 2018
b0e9127
Update README.md
justinjfu Nov 3, 2018
e9e899d
rename get arg config
richardrl Jan 12, 2019
3f7c4d4
rm idea vcs xml
richardrl Jan 12, 2019
392aee2
Merge branch 'refactoring' of github.com:richardrl/doodad-2019-fresh …
richardrl Jan 12, 2019
a711b3d
removed vcs xml
richardrl Jan 12, 2019
5f9e9bd
get arg config rename
richardrl Jan 12, 2019
2d686d9
reup
richardrl Jan 12, 2019
99995fd
gitingore
richardrl Jan 12, 2019
4e8f375
gitignore
richardrl Jan 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore → .gitignogre
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
aws_config/

# Byte-compiled / optimized / DLL files
Expand Down
695 changes: 21 additions & 674 deletions LICENSE

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ python scripts/ec2_setup.py

- (Optional) Set up [Docker](https://docs.docker.com/engine/installation/). This is required on the target machine if running in a Docker-enabled mode.

- (Optional) Set up GCP
- https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu
- https://cloud.google.com/compute/docs/tutorials/python-guide
- https://cloud.google.com/storage/docs/reference/libraries#client-libraries-install-python


## Example

Expand Down
4 changes: 2 additions & 2 deletions doodad/arg_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


__ARGS = None
def __get_arg_config():
def __get_unpickled_arg_config():
"""
global __ARGS
if __ARGS is not None:
Expand All @@ -34,7 +34,7 @@ def __get_arg_config():


def get_args(key=None, default=None):
args = __get_arg_config()
args = __get_unpickled_arg_config()

if args.args_data:
if args.use_cloudpickle:
Expand Down
55 changes: 55 additions & 0 deletions doodad/gcp/gcp_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import os

from doodad.utils import hash_file, call_and_wait, CommandBuilder, REPO_DIR

GCP_STARTUP_SCRIPT_PATH = os.path.join(REPO_DIR, "scripts/gcp/gcp_startup_script.sh")
GCP_SHUTDOWN_SCRIPT_PATH = os.path.join(REPO_DIR, "scripts/gcp/gcp_shutdown_script.sh")

def upload_file_to_gcp_storage(
bucket_name,
file_name,
remote_filename=None,
dry=False,
check_exists=True
):
from google.cloud import storage
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)

if remote_filename is None:
remote_filename = os.path.basename(file_name)
remote_path = 'doodad/mount/' + remote_filename
blob = bucket.blob(remote_path)
if check_exists and blob.exists(storage_client):
print("{remote_path} already exists".format(remote_path=remote_path))
return remote_path
blob.upload_from_filename(file_name)
return remote_path

def get_machine_type(zone, instance_type):
return "zones/{zone}/machineTypes/{instance_type}".format(
zone=zone,
instance_type=instance_type,
)

def get_gpu_type(project, zone, gpu_model):
"""
Check the available gpu models for each zone
https://cloud.google.com/compute/docs/gpus/
"""
assert gpu_model in [
'nvidia-tesla-p4',
'nvidia-tesla-k80',
'nvidia-tesla-v100',
'nvidia-tesla-p100'
]

return (
"https://www.googleapis.com/compute/v1/"
"projects/{project}/zones/{zone}/acceleratorTypes/{gpu_model}".format(
project=project,
zone=zone,
gpu_model=gpu_model
)
)

19 changes: 10 additions & 9 deletions doodad/launch_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ def launch_python(
mode=LOCAL,
mount_points=None,
args=None,
env=None,
dry=False,
fake_display=False,
target_mount_dir='target',
verbose=False,
use_cloudpickle=False,
target_mount=None,
launch_locally=None,
**launch_command_kwargs
):
"""

Expand All @@ -37,7 +36,6 @@ def launch_python(
:param mode:
:param mount_points:
:param args:
:param env:
:param dry:
:param fake_display:
:param target_mount_dir:
Expand All @@ -50,19 +48,21 @@ def launch_python(
args = {}
if mount_points is None:
mount_points = []
if launch_locally is None:
launch_locally = isinstance(mode, Local)

if target_mount is None:
# mount
target_dir = os.path.dirname(target)
if not target_mount_dir:
target_mount_dir = target_dir
target_mount_dir = os.path.join(target_mount_dir, os.path.basename(target_dir))
if isinstance(mode, Local):
if launch_locally:
target_mount = MountLocal(local_dir=target_dir)
else:
target_mount = MountLocal(local_dir=target_dir, mount_point=target_mount_dir)
mount_points = mount_points + [target_mount]
target_full_path = os.path.join(target_mount.docker_mount_dir(), os.path.basename(target))
target_full_path = os.path.join(target_mount.mount_dir(), os.path.basename(target))

command = make_python_command(
target_full_path,
Expand All @@ -71,7 +71,8 @@ def launch_python(
fake_display=fake_display,
use_cloudpickle=use_cloudpickle,
)
mode.launch_command(command, mount_points=mount_points, dry=dry, verbose=verbose)
mode.launch_command(command, mount_points=mount_points,
**launch_command_kwargs)
return target_mount

HEADLESS = 'xvfb-run -a -s "-ac -screen 0 1400x900x24 +extension RANDR"'
Expand All @@ -90,8 +91,8 @@ def make_python_command(

args_encoded, cp_version = encode_args(args, cloudpickle=use_cloudpickle)
if args:
cmd = '%s=%s %s=%s %s=%s %s' % (ARGS_DATA, args_encoded,
USE_CLOUDPICKLE, str(int(use_cloudpickle)),
cmd = '%s=%s %s=%s %s=%s %s' % (ARGS_DATA, args_encoded,
USE_CLOUDPICKLE, str(int(use_cloudpickle)),
CLOUDPICKLE_VERSION, cp_version,
cmd)

Expand Down
Loading