How to use the cliboa.util.constant.StepStatus.SUCCESSFUL_TERMINATION function in cliboa

To help you get started, we’ve selected a few cliboa examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BrainPad / cliboa / cliboa / scenario / load / sftp.py View on Github external
files = super().get_target_files(self._src_dir, self._src_pattern)

        if len(files) > 0:
            for file in files:
                sftp.put_file(
                    file, os.path.join(self._dest_dir, os.path.basename(file))
                )
                self._logger.info("%s is successfully uploaded." % file)
        else:
            self._logger.info(
                "Files to upload do not exist. File pattern: {}".format(
                    os.path.join(self._src_dir, self._src_pattern)
                )
            )
            if self._quit is True:
                return StepStatus.SUCCESSFUL_TERMINATION
github BrainPad / cliboa / cliboa / scenario / load / aws.py View on Github external
bucket = resource.Bucket(self._bucket)
        files = super().get_target_files(self._src_dir, self._src_pattern)

        if len(files) > 0:
            for f in files:
                bucket.upload_file(
                    Key=os.path.join(self._key, os.path.basename(f)), Filename=f
                )
        else:
            self._logger.info(
                "Files to upload do not exist. File pattern: {}".format(
                    os.path.join(self._src_dir, self._src_pattern)
                )
            )
            if self._quit is True:
                return StepStatus.SUCCESSFUL_TERMINATION
github BrainPad / cliboa / cliboa / scenario / extract / sftp.py View on Github external
sftp = Sftp(
            self._host,
            self._user,
            self._password,
            self._key,
            self._timeout,
            self._retry_count,
            self._port,
        )
        files = sftp.list_files(
            self._src_dir, self._dest_dir, re.compile(self._src_pattern)
        )

        if self._quit is True and len(files) == 0:
            self._logger.info("No file was found. After process will not be processed")
            return StepStatus.SUCCESSFUL_TERMINATION

        self._logger.info("Files downloaded %s" % files)

        # cache downloaded file names
        ObjectStore.put(self._step, files)
github BrainPad / cliboa / cliboa / scenario / extract / ftp.py View on Github external
ftp_util = FtpUtil(
            self._host,
            self._user,
            self._password,
            self._timeout,
            self._retry_count,
            self._port,
            self._tls,
        )
        files = ftp_util.list_files(
            self._src_dir, self._dest_dir, re.compile(self._src_pattern)
        )

        if self._quit is True and len(files) == 0:
            self._logger.info("No file was found. After process will not be processed")
            return StepStatus.SUCCESSFUL_TERMINATION

        # cache downloaded file names
        ObjectStore.put(self._step, files)
github BrainPad / cliboa / cliboa / core / worker.py View on Github external
def __execute_steps(self):
        """
        Execute steps in scenario.yml
        """
        res = None
        while not self._scenario_queue.step_queue.is_empty():
            strategy = StepExecutorFactory.create(self._scenario_queue.step_queue.pop())
            strategy.regist_listeners(StepStatusListener())
            res = strategy.execute_steps(self._cmd_args)
            if res is None:
                continue
            elif res == StepStatus.SUCCESSFUL_TERMINATION:
                self._logger.info(
                    "Step response [successful termination]. Scenario will be end."
                )
                break
            else:
                self._logger.error("Step response [%s]. Scenario will be end." % res)
                break

        return StepStatus.SUCCESSFUL_TERMINATION if res is None else res
github BrainPad / cliboa / cliboa / core / worker.py View on Github external
while not self._scenario_queue.step_queue.is_empty():
            strategy = StepExecutorFactory.create(self._scenario_queue.step_queue.pop())
            strategy.regist_listeners(StepStatusListener())
            res = strategy.execute_steps(self._cmd_args)
            if res is None:
                continue
            elif res == StepStatus.SUCCESSFUL_TERMINATION:
                self._logger.info(
                    "Step response [successful termination]. Scenario will be end."
                )
                break
            else:
                self._logger.error("Step response [%s]. Scenario will be end." % res)
                break

        return StepStatus.SUCCESSFUL_TERMINATION if res is None else res