



'''simple docstring'''
import argparse
import math
import traceback

import dateutil.parser as date_parser
import requests






def A__       (	UpperCAmelCase_				):
						_UpperCamelCase   :						Any												=  {}

						_UpperCamelCase   :						Any												=  job['started_at']
						_UpperCamelCase   :						str												=  job['completed_at']

						_UpperCamelCase   :						str												=  date_parser.parse(UpperCAmelCase_				)
						_UpperCamelCase   :						Optional[int]												=  date_parser.parse(UpperCAmelCase_				)

						_UpperCamelCase   :						Any												=  round((end_datetime - start_datetime).total_seconds() / 60.0				)

						_UpperCamelCase   :						List[Any]												=  start
						_UpperCamelCase   :						Optional[Any]												=  end
						_UpperCamelCase   :						Union[str, Any]												=  duration_in_min

						return job_info






def A__       (	UpperCAmelCase_    ,    UpperCAmelCase_=None				):
						_UpperCamelCase   :						Dict												=  None
						if token is not None:
												_UpperCamelCase   :						Optional[Any]												=  {'Accept': 'application/vnd.github+json', 'Authorization': f'Bearer {token}'}

						_UpperCamelCase   :						Any												=  f'https://api.github.com/repos/huggingface/transformers/actions/runs/{workflow_run_id}/jobs?per_page=100'
						_UpperCamelCase   :						List[str]												=  requests.get(UpperCAmelCase_    ,    headers=UpperCAmelCase_				).json()
						_UpperCamelCase   :						Union[str, Any]												=  {}

						try:
												job_time.update({job['name']: extract_time_from_single_job(UpperCAmelCase_				) for job in result['jobs']}				)
												_UpperCamelCase   :						Any												=  math.ceil((result['total_count'] - 1_0_0) / 1_0_0				)

												for i in range(UpperCAmelCase_				):
																		_UpperCamelCase   :						Dict												=  requests.get(url + f'&page={i + 2}'    ,    headers=UpperCAmelCase_				).json()
																		job_time.update({job['name']: extract_time_from_single_job(UpperCAmelCase_				) for job in result['jobs']}				)

												return job_time
						except Exception:
												print(f'Unknown error, could not fetch links:\n{traceback.format_exc()}'				)

						return {}


if __name__ == "__main__":
					snake_case_					:      Any    			=    argparse.ArgumentParser()
					# Required parameters
					parser.add_argument('--workflow_run_id', type=str, required=True, help='A GitHub Actions workflow run id.')
					snake_case_					:      List[Any]    			=    parser.parse_args()

					snake_case_					:      Union[str, Any]    			=    get_job_time(args.workflow_run_id)
					snake_case_					:      int    			=    dict(sorted(job_time.items(), key=lambda item: item[1]["duration"], reverse=True))

					for k, v in job_time.items():
										print(F"""{k}: {v['duration']}""")







'''simple docstring'''
def A__       (	UpperCAmelCase_ = 6_0_0_8_5_1_4_7_5_1_4_3				):

						try:
												_UpperCamelCase   :						str												=  int(UpperCAmelCase_				)
						except (TypeError, ValueError):
												raise TypeError('Parameter n must be int or castable to int.'				)
						if n <= 0:
												raise ValueError('Parameter n must be greater than or equal to one.'				)
						_UpperCamelCase   :						int												=  1
						_UpperCamelCase   :						Optional[Any]												=  2
						while i * i <= n:
												while n % i == 0:
																		_UpperCamelCase   :						Union[str, Any]												=  i
																		n //= i
												i += 1
						if n > 1:
												_UpperCamelCase   :						Dict												=  n
						return int(UpperCAmelCase_				)


if __name__ == "__main__":
					print(F"""{solution() = }""")


