def run(dry_run, print_to_file=None, enable_deletion=False, io_dir='throughput/', thread_pool_size=10, internal=None, use_jump_host=True, light=False, vault_output_path='', extra_labels=None): account_names = [ name for index, name in enumerate(sorted(get_accounts_names())) if is_in_shard_round_robin(name, index) ] if not account_names: logging.warning("No accounts in shards") return exit_codes = threaded.run( tfr_run_wrapper, account_names, thread_pool_size, dry_run=dry_run, print_to_file=print_to_file, enable_deletion=enable_deletion, io_dir=io_dir, internal_thread_pool_size=thread_pool_size, internal=internal, use_jump_host=use_jump_host, light=light, vault_output_path=vault_output_path, extra_labels=extra_labels, ) if any(exit_codes): sys.exit(ExitCodes.ERROR)
def run(dry_run): jira_boards = [j for j in queries.get_jira_boards() if j.get('slack')] accounts = queries.get_state_aws_accounts() settings = queries.get_app_interface_settings() state = State( integration=QONTRACT_INTEGRATION, accounts=accounts, settings=settings ) for index, jira_board in enumerate(jira_boards): if not is_in_shard_round_robin(jira_board['name'], index): continue jira, current_state = fetch_current_state(jira_board, settings) if not current_state: logging.warning( 'not acting on empty Jira boards. ' + 'please create a ticket to get started.' ) continue previous_state = fetch_previous_state(state, jira.project) if previous_state: diffs = calculate_diff(jira.server, current_state, previous_state) act(dry_run, jira_board, diffs) if not dry_run: write_state(state, jira.project, current_state)
def test_is_in_shard_round_robin_three_shards_fail(monkeypatch): monkeypatch.setenv("SHARDS", "3") monkeypatch.setenv("SHARD_ID", "1") importlib.reload(sharding) assert sharding.is_in_shard_round_robin(VALUE, 2) is False
def test_is_in_shard_round_robin_single_shard(monkeypatch): monkeypatch.setenv("SHARDS", "1") monkeypatch.setenv("SHARD_ID", "0") importlib.reload(sharding) assert sharding.is_in_shard_round_robin(VALUE, 1) is True