def test_storage_dir(tmpdir): """ Test that we correctly handle the `storage_dir` argument, which specifies where to download distributed artifacts passed to arguments of type `path`. """ assert os.path.dirname(_get_storage_dir(tmpdir.strpath)) == tmpdir.strpath assert os.path.dirname(_get_storage_dir(None)) == tempfile.gettempdir()
def _get_entry_point_command(project, entry_point, parameters, storage_dir): """ Returns the shell command to execute in order to run the specified entry point. :param project: Project containing the target entry point :param entry_point: Entry point to run :param parameters: Parameters (dictionary) for the entry point command :param storage_dir: Base local directory to use for downloading remote artifacts passed to arguments of type 'path'. If None, a temporary base directory is used. """ storage_dir_for_run = _get_storage_dir(storage_dir) _logger.info( "=== Created directory %s for downloading remote URIs passed to arguments of" " type 'path' ===", storage_dir_for_run) commands = [] commands.append( project.get_entry_point(entry_point).compute_command( parameters, storage_dir_for_run)) return commands