@staticmethod<EOL><INDENT>def from_uri(uri,<EOL>name,<EOL>http_port='<STR_LIT>',<EOL>transport_port='<STR_LIT>',<EOL>settings=None,<EOL>directory=None,<EOL>cleanup=True,<EOL>verbose=False):<DEDENT>
directory = directory or tempfile.mkdtemp()<EOL>filename = os.path.basename(uri)<EOL>crate_dir = re.sub(r'<STR_LIT>', '<STR_LIT>', filename)<EOL>crate_home = os.path.join(directory, crate_dir)<EOL>if os.path.exists(crate_home):<EOL><INDENT>sys.stderr.write('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>_download_and_extract(uri, directory)<EOL><DEDENT>layer = CrateLayer(<EOL>name=name,<EOL>crate_home=crate_home,<EOL>port=http_port,<EOL>transport_port=transport_port,<EOL>settings=settings,<EOL>verbose=verbose)<EOL>if cleanup:<EOL><INDENT>tearDown = layer.tearDown<EOL>def new_teardown(*args, **kws):<EOL><INDENT>shutil.rmtree(directory)<EOL>tearDown(*args, **kws)<EOL><DEDENT>layer.tearDown = new_teardown<EOL><DEDENT>return layer<EOL>
Download the Crate tarball from a URI and create a CrateLayer

        :param uri: The uri that points to the Crate tarball
        :param name: layer and cluster name
        :param http_port: The http port on which Crate will listen
        :param transport_port: the transport port on which Crate will listen
        :param settings: A dictionary that contains Crate settings
        :param directory: Where the tarball will be extracted to.
                          If this is None a temporary directory will be created.
        :param clean: a boolean indicating if the directory should be removed
                      on teardown.
        :param verbose: Set the log verbosity of the test layer