"""
This module defines the main interface for running dlex experiments.
"""
import db # pylint: disable=unused-import

class Client(object):
    """An object for executing CLI commands."""
    def __init__(self, db_name='test.db'):
        self.ddb = db.DLEXDB(db_name)

    def close(self):
        # type: () -> ()
        """Close the CLI object."""
        self.ddb.close()

    def add(self, def_name, def_path):
        # type: (str, str) -> bool
        """Creates a new experiment definition

        This command tries to create a new experiment. It does so by trying
        to load the module at `def_path`.

        Args:
            def_name: name of the experiment to create
            def_path: filesystem path containing the experiment (i.e. a class
            inheriting from the Experiment class)

        Returns:
            True on success, False on failure
        """
        def_id = self.ddb.insert_definition(def_name, def_path)
        if def_id is None:
            return False
        return True

    def remove(self, def_name):
        # type: (str) -> bool
        """Removes an experiment definition

        Args:
            def_name: name of the experiment definition to remove

        Returns:
            True on success, False on failure
        """
        return self.ddb.delete_definition(def_name)

    def list(self):
        # type: () -> List[Union[None, Dict[str, Union[int, str]]]]
        """Lists all experiment difinitions

        Returns:
            A list of all experiment definitions
        """
        return self.ddb.get_definitions()

    def create(self, def_name, hyperparams):
        # type: (str, Dict[str, Union[int, str]]) -> int
        """Creates a new experiment from a definition

        Args:
            def_name: (str) name of the experiment definition
            hyperparams: (dict) a dict of the hyperparams for the experiment

        Returns:
            The ID of the experiment
        """
        return self.ddb.create_experiment(def_name, hyperparams)

@@ -83,40 +83,24 @@
 t db
- # pylint: disable=unused-import
+%0Aimport unix_rpc
 %0A%0Acl
@@ -207,16 +207,46 @@
 test.db'
+, socket_path='/tmp/sock_path'
 ):%0A     
@@ -273,24 +273,63 @@
 XDB(db_name)
+%0A        self.socket_path = socket_path
 %0A%0A    def cl
@@ -1655,22 +1655,19 @@
     def 
-create
+run
 (self, d
@@ -1713,44 +1713,29 @@
 (str
-, Dict%5Bstr, Union%5Bint, str%5D%5D) -%3E
+) -%3E Union%5BNone,
  int
+%5D
 %0A   
@@ -1738,37 +1738,31 @@
 %0A        %22%22%22
-Creates a new
+Runs an
  experiment 
@@ -1764,15 +1764,18 @@
 ment
- from a
+, based on
  def
@@ -1785,64 +1785,78 @@
 tion
-%0A%0A        Args:%0A            def_name: (str) name of the 
+ %60def_name%60.%22%22%22%0A        print('run')%0A        exp_id = self.ddb.create_
 expe
@@ -1865,97 +1865,124 @@
 ment
- definition%0A            hyperparams: (dict) a dict of the hyperparams for the experiment%0A
+(def_name, hyperparams)%0A        client = unix_rpc.Client(self.socket_path)%0A        client.run('arg1', exp_id=exp_id)
 %0A   
@@ -1990,42 +1990,113 @@
     
-R
+r
 eturn
-s:%0A            The ID
+ exp_id%0A%0A    def status(self):%0A        # type: () -%3E List%5BAny%5D%0A        %22%22%22Returns the status
  of 
-the
+all
  exp
@@ -2102,25 +2102,17 @@
 periment
-%0A        
+s
 %22%22%22%0A    
@@ -2135,45 +2135,17 @@
 ddb.
-create_experiment(def_name, hyperparams
+get_status(
 )%0A

Add new commands to client