Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_run_tree_info(self):
config_file_path = os.path.join(os.path.dirname(__name__), 'test_config.ini')
luigi.configuration.LuigiConfigParser.add_config_path(config_file_path)
os.environ.setdefault('test_param', 'test')
tree_info = gokart.tree_info(mode='simple', output_path='tree.txt')
with self.assertRaises(SystemExit):
gokart.run()
self.assertTrue(gokart.make_tree_info(_DummyTask(param='test')), tree_info.output().load())
def _try_to_send_event_summary_to_slack(slack_api: Optional[gokart.slack.SlackAPI],
event_aggregator: gokart.slack.EventAggregator, cmdline_args: List[str]):
if slack_api is None:
# do nothing
return
with CmdlineParser.global_instance(cmdline_args) as cp:
task = cp.get_task_obj()
tree_info = gokart.make_tree_info(task, details=True)
task_name = type(task).__name__
comment = f'Report of {task_name}' + os.linesep + event_aggregator.get_summary()
content = os.linesep.join([
'===== Event List ====',
event_aggregator.get_event_list(),
os.linesep,
'==== Tree Info ====',
tree_info,
])
slack_api.send_snippet(comment=comment, title='event.txt', content=content)