gbdx_cloud_harness/controller.py
def _register_anonymous_task(self):
        """
        Register the anonymouse task or overwrite it.
        :return: success or fail message.
        """
        is_overwrite = self._arguments.get('--overwrite')
        task_name = "CloudHarness_Anonymous_Task"

        task_srv = TaskService()

        if is_overwrite:
            # Delete the task first
            code, message = task_srv.delete_task(task_name)
            # ignore status if deleted, or not registered
            if code not in [200, 400]:
                raise TaskRegistryError(message)

        task_def_file = os.path.join(
            os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
            'gbdx_task_template', 'task_definition.json'
        )

        with open(task_def_file, 'r') as f:
            code, message = task_srv.register_task(f.read())
            if code == 200:
                print(message)
            elif code == 409:
                print('Task already exists')
            else:
                raise TaskRegistryError(message)
def _register_anonymous_task(self):
        """
        Register the anonymouse task or overwrite it.
        :return: success or fail message.
        """
        is_overwrite = self._arguments.get('--overwrite')
        task_name = "CloudHarness_Anonymous_Task"

        task_srv = TaskService()

        if is_overwrite:
            # Delete the task first
            code, message = task_srv.delete_task(task_name)
            # ignore status if deleted, or not registered
            if code not in [200, 400]:
                raise TaskRegistryError(message)

        task_def_file = os.path.join(
            os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
            'gbdx_task_template', 'task_definition.json'
        )

        with open(task_def_file, 'r') as f:
            code, message = task_srv.register_task(f.read())
            if code == 200:
                print(message)
            elif code == 409:
                print('Task already exists')
            else:
                raise TaskRegistryError(message)
Register the anonymouse task or overwrite it.
        :return: success or fail message.