def main(): process_data = [{} for item in range(8)] print('Procesing names...') MP4ansi(function=do_work, process_data=process_data).execute() print( f"Total names processed {sum([item['result'] for item in process_data])}" )
def main(): process_data = [{} for item in range(8)] config = { 'id_regex': r'^processor is (?P<value>.*)$', 'text_regex': r'^process.*$' } print('Procesing names...') MP4ansi(function=do_work, process_data=process_data, config=config).execute() print(f"Total names processed {sum([item['result'] for item in process_data])}")
def run_create_pull_request_workflows(owner, repos_data, repos_regex): """ execute pull request workflow """ print(f'Executing pull request workflows for {owner} ...') process_data = get_process_data_for_pull_request_workflows(repos_data, repos_regex) MP4ansi( function=create_pull_request_workflow, process_data=process_data, config={ 'id_regex': fr'^creating pull request workflow for {owner}/(?P<value>.*)$', 'id_justify': True, 'id_width': 23, # 'progress_bar': { # 'total': r'^pull request workflow has a total of (?P<value>\d+) steps$', # 'count_regex': r'^executing step (?P<value>-) .*$', # 'progress_message': 'Pull request workflow complete' # } }).execute(raise_if_error=True)
def run_jenkins_data_collection(owner): """ run jenkins data collection """ print(f'Retrieving jenkins data for {owner} ...') process_data = [{'owner': owner}] MP4ansi( function=get_jenkins_data, process_data=process_data, config={ 'id_regex': r'^getting jenkins information for (?P<value>.*) repos$', 'progress_bar': { 'total': r'^.* has a total of (?P<value>\d+) repos registered in jenkins$', 'count_regex': r'^retrieving jenkins data for (?P<value>.*) repo$', 'progress_message': 'Retrieval of jenkins data complete' } }).execute(raise_if_error=True) # write_file(process_data, 'jenkins') return process_data
def run_github_data_collection(owner): """ run github data collection """ print(f'Retrieving github repos for {owner}') process_data = [{'owner': owner}] MP4ansi( function=get_github_data, process_data=process_data, config={ 'id_regex': r'^getting github information for (?P<value>.*) repos$', 'progress_bar': { 'total': r'^.* has a total of (?P<value>\d+) matching repos in github$', 'count_regex': r'^checking repo (?P<value>.*)$', 'progress_message': 'Retrieval of github.com repos complete' } }).execute(raise_if_error=True) # write_file(process_data, 'github') return process_data
def main(): # configure_logging() process_data = [{ 'range': '00001-10000' }, { 'range': '10001-20000' }, { 'range': '20001-30000' }, { 'range': '30001-40000' }, { 'range': '40001-50000' }, { 'range': '50001-60000' }, { 'range': '60001-70000' }, { 'range': '70001-80000' }, { 'range': '80001-90000' }] # , # {'range': '90001-100000'}] config = { 'id_regex': r'^INFO: finding prime numbers in range (?P<value>.*)$', 'progress_bar': { # 'total': r'^checking total of (?P<value>\d+) numbers$', 'total': 10000, 'count_regex': r'^checking (?P<value>\d+)/\d+$', 'max_total': 90000 } } # mp4ansi = MPcontroller(function=check_primes, process_data=process_data) mp4ansi = MP4ansi(function=check_primes, process_data=process_data, config=config) print('Computing prime numbers...') mp4ansi.execute() total_primes = 0 for process in process_data: total_primes += len(process['result']) print(f'Total number of primes is: {total_primes}')
def main(): process_data = [{} for item in range(8)] config = { 'id_regex': r'^processor is (?P<value>.*)$', 'progress_bar': { 'total': r'^processing total of (?P<value>\d+)$', 'count_regex': r'^processed (?P<value>.*)$', 'progress_message': 'Finished processing names', 'max_total': TOTAL_ITEMS, 'max_completed': TOTAL_NAMES, 'wtf': True } } print('Procesing names...') MP4ansi(function=do_work, process_data=process_data, config=config).execute() print( f"Total names processed {sum([item['result'] for item in process_data])}" )
def main(count): configure_logging() process_data = get_process_data(count) config = { 'id_regex': r'^processor id (?P<value>.*)$', 'progress_bar': { 'total': r'^processing total of (?P<value>\d+)$', 'count_regex': r'^processed (?P<value>\d+)$', 'max_total': TOTAL } } print('Processing...') mp4ansi = MP4ansi(function=do_something, process_data=process_data, config=config) mp4ansi.execute() # print(mp4ansi.terminal.move_up(0), end='') # mp4ansi = MP4ansi(function=do_something, process_data=process_data, config=config) # mp4ansi.execute() print(f'Total processed: {get_total_processed(process_data)}')
def test__init_Should_InstantiateTerminal_When_Called(self, terminal_patch, *patches): process_data = [{'id': 1}, {'id': 2}] config = {'key': 'value'} client = MP4ansi(function=Mock(__name__='mockfunc'), process_data=process_data, config=config) terminal_patch.assert_called_once_with(len(process_data), config=config, durations={}) self.assertEqual(client.terminal, terminal_patch.return_value)
def get_client(self): process_data = [{'id': 1}, {'id': 2}] config = {'key': 'value'} return MP4ansi(function=Mock(__name__='mockfunc'), process_data=process_data, config=config)