Skip to content

Commit

Permalink
Merge pull request #228 from datmo/environment-setup
Browse files Browse the repository at this point in the history
environment setup + workspace addition
  • Loading branch information
asampat3090 committed Jul 18, 2018
2 parents 156d18c + 5b59c55 commit 4d17864
Show file tree
Hide file tree
Showing 42 changed files with 1,749 additions and 2,002 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
\
# ![Datmo Logo](images/datmo-logo.png)
[![PyPI version](https://badge.fury.io/py/datmo.svg)](https://badge.fury.io/py/datmo)
[![Coverage Status](https://coveralls.io/repos/github/datmo/datmo/badge.svg?branch=master)](https://coveralls.io/github/datmo/datmo?branch=master)
Expand All @@ -10,8 +11,16 @@
| <img height="20" src="http://icons.iconarchive.com/icons/icons8/windows-8/128/Systems-Mac-Os-icon.png"> | [![CircleCI branch](https://circleci.com/gh/datmo/datmo.svg?style=shield)](https://circleci.com/gh/datmo/datmo) |
| <img height="20" src="http://icons.iconarchive.com/icons/dakirby309/windows-8-metro/128/Folders-OS-Windows-8-Metro-icon.png"> | [![Windows](https://ci.appveyor.com/api/projects/status/5302d8a23qr4ui4y/branch/master?svg=true)](https://ci.appveyor.com/project/asampat3090/datmo/branch/master) |

# Datmo Alpha Release

**Datmo** is an open source model tracking and reproducibility tool for developers. Use `datmo init` to turn any repository into a trackable task record with reusable environments and metrics logging.


**Note**: The current version of Datmo is an alpha release. This means commands are subject to change. If you find any bugs please
feel free contribute by adding issues so the contributors can address them.



## Features

- **One command environment setup** (languages, frameworks, packages, etc)
Expand Down
1 change: 0 additions & 1 deletion datmo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@
log.info("handling command %s", config.home)

import datmo.snapshot
import datmo.task
import datmo.config
4 changes: 2 additions & 2 deletions datmo/cli/command/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ def task_run_helper(self, task_dict, snapshot_dict, error_identifier):
self.cli_helper.echo(__("error", error_identifier, task_obj.id))
return False
finally:
self.cli_helper.echo(__("info", "cli.task.run.stop"))
self.cli_helper.echo(__("info", "cli.run.run.stop"))
self.task_controller.stop(
task_id=updated_task_obj.id, status=status)
self.cli_helper.echo(
__("info", "cli.task.run.complete", updated_task_obj.id))
__("info", "cli.run.run.complete", updated_task_obj.id))

return updated_task_obj

Expand Down
40 changes: 32 additions & 8 deletions datmo/cli/command/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,36 @@ def environment(self):
@Helper.notify_no_project_found
def setup(self, **kwargs):
self.environment_controller = EnvironmentController()
name = kwargs.get("name", None)
available_environments = self.environment_controller.get_supported_environments(
)
if not name:
name = self.cli_helper.prompt_available_environments(
available_environments)
environment_type = kwargs.get("type", None)
environment_framework = kwargs.get("framework", None)
environment_language = kwargs.get("language", None)
# TODO: remove business logic from here and create common helper
# environment types
environment_types = self.environment_controller.get_environment_types()
if not environment_type or environment_type not in environment_types:
environment_type = self.cli_helper.prompt_available_options(
environment_types, option_type="type")
# environment frameworks
available_framework_details = self.environment_controller.get_supported_frameworks(
environment_type)
available_frameworks = [
item[0] for item in available_framework_details
]
if not environment_framework or environment_framework not in available_frameworks:
environment_framework = self.cli_helper.prompt_available_options(
available_framework_details, option_type="framework")
# environment languages
available_environment_languages = self.environment_controller.get_supported_languages(
environment_type, environment_framework)
if available_environment_languages and not environment_language or environment_language not in available_environment_languages:
environment_language = self.cli_helper.prompt_available_options(
available_environment_languages, option_type="language")
try:
options = {"name": name}
options = {
"environment_type": environment_type,
"environment_framework": environment_framework,
"environment_language": environment_language
}
environment_obj = self.environment_controller.setup(
options=options)
self.cli_helper.echo(
Expand All @@ -38,7 +60,9 @@ def setup(self, **kwargs):
return environment_obj
except EnvironmentDoesNotExist:
self.cli_helper.echo(
__("error", "cli.environment.setup.argument", name))
__("error", "cli.environment.setup.argument",
"%s:%s-%s" % (environment_framework, environment_type,
environment_language)))

@Helper.notify_no_project_found
def create(self, **kwargs):
Expand Down
39 changes: 24 additions & 15 deletions datmo/cli/command/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from datmo.cli.driver.helper import Helper
from datmo.cli.command.base import BaseCommand
from datmo.core.controller.project import ProjectController
from datmo.core.controller.environment.environment import EnvironmentController, EnvironmentDoesNotExist
from datmo.core.controller.environment.environment import EnvironmentController


class ProjectCommand(BaseCommand):
Expand Down Expand Up @@ -102,23 +102,32 @@ def init(self, name, description):
environment_setup = self.cli_helper.prompt_bool(
__("prompt", "cli.project.environment.setup"))
if environment_setup:
# TODO: ramove business logic from here and create common helper
# Setting up the environment definition file
self.environment_controller = EnvironmentController()
available_environments = self.environment_controller.get_supported_environments(
environment_types = self.environment_controller.get_environment_types(
)
input_environment_name = self.cli_helper.prompt_available_environments(
available_environments)
try:
options = {"name": input_environment_name}
environment_obj = self.environment_controller.setup(
options=options)
self.cli_helper.echo(
__("info", "cli.environment.setup.success",
(environment_obj.name, environment_obj.id)))
except EnvironmentDoesNotExist:
self.cli_helper.echo(
__("error", "cli.environment.setup.argument",
input_environment_name))
environment_type = self.cli_helper.prompt_available_options(
environment_types, option_type="type")
available_environment_frameworks = self.environment_controller.get_supported_frameworks(
environment_type)
environment_framework = self.cli_helper.prompt_available_options(
available_environment_frameworks, option_type="framework")
available_environment_languages = self.environment_controller.get_supported_languages(
environment_type, environment_framework)
environment_language = self.cli_helper.prompt_available_options(
available_environment_languages, option_type="language")
options = {
"environment_type": environment_type,
"environment_framework": environment_framework,
"environment_language": environment_language
}
environment_obj = self.environment_controller.setup(
options=options)
self.cli_helper.echo(
__("info", "cli.environment.setup.success",
(environment_obj.name, environment_obj.id)))

return self.project_controller.model

def version(self):
Expand Down

0 comments on commit 4d17864

Please sign in to comment.