def unix(value): if isinstance(value, (date, builtin_datetime)): pass elif value < 10000000000: value = unix2datetime(value) else: value = milli2datetime(value) return str(datetime2unix(value))
def datetime(value): if isinstance(value, (date, builtin_datetime)): pass elif value < 10000000000: value = unix2datetime(value) else: value = milli2datetime(value) return datetime2string(value, "%Y-%m-%d %H:%M:%S")
def unix(value): """ Convert a date, or datetime to unix timestamp :param value: :return: """ if isinstance(value, (date, builtin_datetime)): pass elif value < 10000000000: value = unix2datetime(value) else: value = milli2datetime(value) return str(datetime2unix(value))
def datetime(value): """ Convert from unix timestamp to GMT string :param value: unix timestamp :return: string with GMT time """ if isinstance(value, (date, builtin_datetime)): pass elif value < 10000000000: value = unix2datetime(value) else: value = milli2datetime(value) return datetime2string(value, "%Y-%m-%d %H:%M:%S")
def unix(value): """ Convert a date, or datetime to unix timestamp :param value: :return: """ if isinstance(value, (date, builtin_datetime)): pass elif value < 10000000000: value = unix2datetime(value) else: value = milli2datetime(value) return str(datetime2unix(value))
def datetime(value): """ Convert from unix timestamp to GMT string :param value: unix timestamp :return: string with GMT time """ if isinstance(value, (date, builtin_datetime)): pass elif value < 10000000000: value = unix2datetime(value) else: value = milli2datetime(value) return datetime2string(value, "%Y-%m-%d %H:%M:%S.%f").rstrip(".000000").rstrip("000")
def datetime(value): """ Convert from unix timestamp to GMT string :param value: unix timestamp :return: string with GMT time """ if isinstance(value, (date, builtin_datetime)): pass elif value < 10000000000: value = unix2datetime(value) else: value = milli2datetime(value) output = datetime2string(value, "%Y-%m-%d %H:%M:%S.%f") if output.endswith(".000000"): return output[:-7] elif output.endswith("000"): return output[:-3] else: return output
def complex_job( transactional_db, generic_reference_data, test_repository, extract_job_settings, now ): fc = FailureClassification.objects.create(id=1, name="not classified") repository_group = RepositoryGroup.objects.create(name="common") repo = Repository.objects.create(name="autoland", repository_group=repository_group) push = Push.objects.create( **{ "author": "*****@*****.**", "repository": repo, "revision": "ae6bb3a1066959a8c43d003a3caab0af769455bf", "time": unix2datetime(1578427105).replace(tzinfo=None), } ) Commit.objects.create( push=push, revision="ae6bb3a1066959a8c43d003a3caab0af769455bf", author="*****@*****.**", comments="no comment", ) Commit.objects.create( push=push, revision="0123456789012345678901234567890123456789", author="*****@*****.**", comments="no comment2", ) debug = Option.objects.create(name="debug") oc = OptionCollection.objects.create(option_collection_hash=Random.base64(5), option=debug) job = Job.objects.create( autoclassify_status=1, guid=Random.base64(20), repository=test_repository, push_id=push.id, signature=generic_reference_data.signature, build_platform=generic_reference_data.build_platform, machine_platform=generic_reference_data.machine_platform, machine=generic_reference_data.machine, option_collection_hash=oc.option_collection_hash, job_type=generic_reference_data.job_type, job_group=generic_reference_data.job_group, product=generic_reference_data.product, failure_classification_id=fc.id, who="*****@*****.**", reason="scheduled", result="success", state="completed", submit_time=unix2datetime(1578427253).replace(tzinfo=None), start_time=unix2datetime(1578430841).replace(tzinfo=None), last_modified=unix2datetime(1578432686.364459).replace(tzinfo=None), end_time=unix2datetime(1578432680).replace(tzinfo=None), tier=1, ) text_log_step = TextLogStep.objects.create( job=job, **{ "finished_line_number": 88739, "name": "Unnamed step", "result": 7, "started_line_number": 0, }, ) TextLogError.objects.create( step=text_log_step, line="line contents here", line_number=619845839 ) TextLogError.objects.create(step=text_log_step, line="ERROR! more line contents", line_number=6) TaskclusterMetadata.objects.create(job=job, retry_id=0, task_id="WWb9ExAvQUa78ku0DIxdSQ") JobLog.objects.create( **{ "job_id": job.id, "name": "builds-4h", "status": 1, "url": "https://example.com/api/queue/v1/task/WWb9ExAvQUa78ku0DIxdSQ/runs/0/artifacts/public/logs/live_backing.log", } ) job_logs1 = JobLog.objects.create( **{ "job_id": job.id, "name": "errorsummary_json", "status": 1, "url": "https://example.com/api/queue/v1/task/WWb9ExAvQUa78ku0DIxdSQ/runs/0/artifacts/public/test_info/wpt_errorsummary.log", } ) bcf = ClassifiedFailure.objects.create(**{"bug_number": 1234567,}) bcf.created = Date("2020-01-17 12:00:00").datetime bcf.save() FailureLine.objects.create( job_log=job_logs1, **{ "action": "test_groups", "best_classification": bcf, "best_is_verified": True, "repository": repo, "job_guid": job.guid, "line": 15, "modified": 0, "stackwalk_stderr": 1578432686, "stackwalk_stdout": 1578432686, }, ) FailureLine.objects.create( job_log=job_logs1, **{ "action": "crash", "best_classification": bcf, "best_is_verified": False, "repository": repo, "job_guid": job.guid, "line": 24031, "modified": 0, "signature": "@ mozilla::dom::CustomElementData::SetCustomElementDefinition(mozilla::dom::CustomElementDefinition*)", "stackwalk_stderr": 1578432686, "stackwalk_stdout": 1578432686, "test": "/custom-elements/upgrading.html", }, ) return job