def METHOD_NAME(self):
    # We don't know if the task in question already exists, so we try a few times. Checking
    # beforehand would not be an option because a concurrent unit test could potentially
    # create the same task and make this unit test fail (i.e. getting a dataset and creating
    # a task for it is not atomic).
    compatible_datasets = self._get_compatible_rand_dataset()
    for i in range(100):
        try:
            dataset_id = compatible_datasets[i % len(compatible_datasets)]
            # TODO consider implementing on the diff task types.
            task = create_task(
                task_type=self.task_type,
                dataset_id=dataset_id,
                target_name=self._get_random_feature(dataset_id),
                estimation_procedure_id=self.estimation_procedure,
            )
            task.publish()
            TestBase._mark_entity_for_removal("task", task.id)
            TestBase.logger.info(
                "collected from {}: {}".format(__file__.split("/")[-1], task.id)
            )
            # success
            break
        except OpenMLServerException as e:
            # Error code for 'task already exists'
            # Should be 533 according to the docs
            # (# https://www.openml.org/api_docs#!/task/post_task)
            if e.code == 614:
                continue
            else:
                raise e
    else:
        raise ValueError(
            "Could not create a valid task for task type ID {}".format(self.task_type)
        )