def METHOD_NAME(
    cache,
    user,
    user_job_id,
    project_id,
    dataset_uri,
    name=None,
    extract=False,
    tag=None,
    timeout=None,
    commit_message=None,
    data_directory=None,
):
    """Job for dataset import."""
    user = cache.ensure_user(user)
    worker_log.debug(f"executing dataset import job for {user.user_id}:{user.fullname}")
    user_job = cache.get_job(user, user_job_id)
    user_job.in_progress()
    try:
        worker_log.debug(f"retrieving metadata for project {project_id}")
        project = cache.get_project(user, project_id)
        with renku_project_context(project.abs_path):
            worker_log.debug(f"project found in cache - importing dataset {dataset_uri}")
            communicator = ServiceCallback(user_job=user_job)
            gitlab_token = user.token if _is_safe_to_pass_gitlab_token(project.git_url, dataset_uri) else None
            command = import_dataset_command().with_commit_message(commit_message)
            command.with_communicator(communicator).build().execute(
                uri=dataset_uri,
                name=name,
                extract=extract,
                tag=tag,
                yes=True,
                gitlab_token=gitlab_token,
                datadir=data_directory,
            )
            worker_log.debug("operation successful - syncing with remote")
            remote_branch = push_changes(Repository(project.abs_path), remote="origin")
            user_job.update_extras("remote_branch", remote_branch)
            user_job.complete()
            worker_log.debug("job completed")
    except (HTTPError, errors.ParameterError, errors.RenkuException, errors.GitCommandError) as exp:
        user_job.fail_job(str(exp))
        # Reraise exception, so we see trace in job metadata
        # and in metrics as failed job.
        raise exp