Tests / apps/projects/tests.py
RealProfileDocumentTest::test_call_tree
First seen 7 hours ago in 78a4357
CI
github-actions:test
5 runs
Average
234 ms
median 239 ms
max 303 ms
max 303 ms
Phases
Setup 218 ms
Call 15 ms
Teardown 0.45 ms
Categories
Database 96 ms
App code 13 ms
Factories 0.44 ms
Other (Serialization, Libraries, Deep copies, pytest, ...) 125 ms
89 database queries per run
Needs 2 MB of memory (max 2 MB)
Duration per run
Where the time goes
Latest run in ci:github-actions:test, 18 minutes ago ·
open run
setup286 ms94.3%
TestCase.setUpClassdjango/test/testcases.py:1439 cls.setUpTestData()276 ms90.9%
RealProfileDocumentTest.setUpTestDataapps/projects/tests.py:839207 ms68.3%
store_profileapps/projects/testing.py:373192 ms63.5%
process_profile_partapps/projects/profiles.py:341164 ms54.2%
load_documentapps/projects/profiles.py:112 return json.loads(gzip.decompress(bytes(part.document)))164 ms54.2%
loads<stdlib>/json/__init__.py:371163 ms53.8%
JSONDecoder.decode<stdlib>/json/decoder.py:358163 ms53.8%
JSONDecoder.raw_decode<stdlib>/json/decoder.py:374163 ms53.8%
<GC>~163 ms53.8%
1 smaller frames hidden
process_profile_partapps/projects/profiles.py:34610 ms3.3%
write_snapshotsapps/projects/profiles.py:3126 ms1.9%
write_snapshots.<locals>.<genexpr>apps/projects/profiles.py:3106 ms1.9%
write_snapshots.<locals>.rowapps/projects/profiles.py:306 compress(json.dumps(snapshot_document(document, entry), separators=(",", ":")).encode()),6 ms1.9%
compressapps/projects/profiles.py:108 return gzip.compress(data, compresslevel=6)2 ms0.7%
compress<stdlib>/gzip.py:6682 ms0.7%
3 smaller frames hidden
write_snapshotsapps/projects/profiles.py:313 cursor.executemany(SNAPSHOT_UPSERT, batch)5 ms1.5%
CursorWrapper.executemanydjango/db/backends/utils.py:845 ms1.5%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:925 ms1.5%
CursorWrapper._executemanydjango/db/backends/utils.py:1145 ms1.5%
Cursor.executemanypsycopg/cursor.py:1372 ms0.7%
Connection._pipeline_nolockpsycopg/connection.py:4722 ms0.7%
Pipeline.__exit__psycopg/_pipeline.py:732 ms0.7%
Connection.waitpsycopg/connection.py:4952 ms0.7%
Cursor.executemanypsycopg/cursor.py:1382 ms0.7%
Connection.waitpsycopg/connection.py:4952 ms0.7%
process_profile_partapps/projects/profiles.py:342 profile = claim_part(part, document)7 ms2.2%
claim_partapps/projects/profiles.py:3782 ms0.7%
get_or_create_environmentapps/projects/environments.py:63 obj, created = Environment.objects.get_or_create(2 ms0.7%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms0.7%
4 smaller frames hidden
process_profile_partapps/projects/profiles.py:345 write_perfs(profile, part, entries, tests)5 ms1.5%
write_perfsapps/projects/profiles.py:458 TestPerf.objects.bulk_create(2 ms0.7%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms0.7%
QuerySet.bulk_createdjango/db/models/query.py:8332 ms0.7%
QuerySet._batched_insertdjango/db/models/query.py:19562 ms0.7%
QuerySet._insertdjango/db/models/query.py:19182 ms0.7%
2 smaller frames hidden
process_profile_partapps/projects/profiles.py:3443 ms1.1%
upsert_testsapps/projects/profiles.py:4513 ms1.1%
3 smaller frames hidden
store_profileapps/projects/testing.py:374 finalize_profile(profile.id)10 ms3.3%
finalize_profileapps/projects/profiles.py:4963 ms1.1%
6 smaller frames hidden
store_profileapps/projects/testing.py:372 part = ProfilePart.objects.create(profile=profile, index=0, document=compress(data), document_size=len(data))3 ms1.1%
compressapps/projects/profiles.py:108 return gzip.compress(data, compresslevel=6)2 ms0.7%
compress<stdlib>/gzip.py:6682 ms0.7%
1 smaller frames hidden
1 smaller frames hidden
RealProfileDocumentTest.setUpTestDataapps/projects/tests.py:83862 ms20.4%
store_profileapps/projects/testing.py:37338 ms12.6%
process_profile_partapps/projects/profiles.py:34615 ms4.8%
write_snapshotsapps/projects/profiles.py:31210 ms3.3%
write_snapshots.<locals>.<genexpr>apps/projects/profiles.py:31010 ms3.3%
write_snapshots.<locals>.rowapps/projects/profiles.py:306 compress(json.dumps(snapshot_document(document, entry), separators=(",", ":")).encode()),10 ms3.3%
snapshot_documentapps/projects/profiles.py:2506 ms1.9%
snapshot_document.<locals>.node_idapps/projects/profiles.py:238 while isinstance(node, int) and 0 <= node < len(stacks) and node not in node_ids and len(path) <= len(stacks):3 ms1.1%
2 smaller frames hidden
compressapps/projects/profiles.py:108 return gzip.compress(data, compresslevel=6)3 ms1.1%
compress<stdlib>/gzip.py:6683 ms1.1%
1 smaller frames hidden
write_snapshotsapps/projects/profiles.py:313 cursor.executemany(SNAPSHOT_UPSERT, batch)5 ms1.5%
CursorWrapper.executemanydjango/db/backends/utils.py:845 ms1.5%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:925 ms1.5%
CursorWrapper._executemanydjango/db/backends/utils.py:1145 ms1.5%
Cursor.executemanypsycopg/cursor.py:1373 ms1.1%
Connection._pipeline_nolockpsycopg/connection.py:4723 ms1.1%
Pipeline.__exit__psycopg/_pipeline.py:733 ms1.1%
Connection.waitpsycopg/connection.py:4953 ms1.1%
1 smaller frames hidden
process_profile_partapps/projects/profiles.py:342 profile = claim_part(part, document)9 ms3.0%
claim_partapps/projects/profiles.py:383 commit, _ = Commit.objects.get_or_create(2 ms0.7%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms0.7%
QuerySet.get_or_createdjango/db/models/query.py:9922 ms0.7%
claim_partapps/projects/profiles.py:4462 ms0.7%
Profile.saveapps/projects/models.py:466 super().save(*args, **kwargs)2 ms0.7%
Model.savedjango/db/models/base.py:8742 ms0.7%
Model.save_basedjango/db/models/base.py:9662 ms0.7%
Model._save_tabledjango/db/models/base.py:11102 ms0.7%
Model._do_updatedjango/db/models/base.py:12112 ms0.7%
QuerySet._updatedjango/db/models/query.py:13272 ms0.7%
SQLUpdateCompiler.execute_returning_sqldjango/db/models/sql/compiler.py:21402 ms0.7%
SQLUpdateCompiler.execute_sqldjango/db/models/sql/compiler.py:21112 ms0.7%
SQLCompiler.execute_sqldjango/db/models/sql/compiler.py:16242 ms0.7%
CursorWrapper.executedjango/db/backends/utils.py:792 ms0.7%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:922 ms0.7%
CursorWrapper._executedjango/db/backends/utils.py:1052 ms0.7%
Cursor.executepsycopg/cursor.py:1132 ms0.7%
Connection.waitpsycopg/connection.py:4952 ms0.7%
4 smaller frames hidden
process_profile_partapps/projects/profiles.py:3446 ms1.9%
upsert_testsapps/projects/profiles.py:4516 ms1.9%
TestManager.upsertapps/projects/models.py:2292 ms0.7%
TestManager.upsertapps/projects/models.py:230 self.bulk_create( # sorted, so uploads sharing tests lock their rows in the same order2 ms0.7%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms0.7%
QuerySet.bulk_createdjango/db/models/query.py:8332 ms0.7%
QuerySet._batched_insertdjango/db/models/query.py:19562 ms0.7%
QuerySet._insertdjango/db/models/query.py:19182 ms0.7%
1 smaller frames hidden
process_profile_partapps/projects/profiles.py:3416 ms1.9%
load_documentapps/projects/profiles.py:112 return json.loads(gzip.decompress(bytes(part.document)))6 ms1.9%
loads<stdlib>/json/__init__.py:3716 ms1.9%
JSONDecoder.decode<stdlib>/json/decoder.py:3586 ms1.9%
JSONDecoder.raw_decode<stdlib>/json/decoder.py:3746 ms1.9%
3 smaller frames hidden
store_profileapps/projects/testing.py:374 finalize_profile(profile.id)12 ms4.1%
finalize_profileapps/projects/profiles.py:4966 ms1.9%
add_perfsapps/projects/rollups.py:64 for row in TestDailyStats.objects.filter(2 ms0.7%
add_perfsapps/projects/rollups.py:88 TestDailyStats.objects.bulk_create(2 ms0.7%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms0.7%
1 smaller frames hidden
6 smaller frames hidden
store_profileapps/projects/testing.py:372 part = ProfilePart.objects.create(profile=profile, index=0, document=compress(data), document_size=len(data))6 ms1.9%
compressapps/projects/profiles.py:108 return gzip.compress(data, compresslevel=6)5 ms1.5%
compress<stdlib>/gzip.py:6685 ms1.5%
1 smaller frames hidden
store_profileapps/projects/testing.py:3712 ms0.7%
BaseManager._get_queryset_methods.<locals>.create_method.<locals>.manager_methoddjango/db/models/manager.py:872 ms0.7%
QuerySet.createdjango/db/models/query.py:6692 ms0.7%
store_profileapps/projects/testing.py:375 profile.refresh_from_db()2 ms0.7%
Model.refresh_from_dbdjango/db/models/base.py:7582 ms0.7%
QuerySet.getdjango/db/models/query.py:6352 ms0.7%
QuerySet.__len__django/db/models/query.py:3722 ms0.7%
QuerySet._fetch_alldjango/db/models/query.py:20002 ms0.7%
1 smaller frames hidden
RealProfileDocumentTest.setUpTestDataapps/projects/tests.py:835 cls.project = baker.make(Project)3 ms1.1%
makemodel_bakery/baker.py:1473 ms1.1%
Baker.makemodel_bakery/baker.py:4063 ms1.1%
Baker._makemodel_bakery/baker.py:4712 ms0.7%
Baker.generate_valuemodel_bakery/baker.py:8002 ms0.7%
gen_relatedmodel_bakery/random_gen.py:2742 ms0.7%
makemodel_bakery/baker.py:1472 ms0.7%
Baker.makemodel_bakery/baker.py:4062 ms0.7%
1 smaller frames hidden
RealProfileDocumentTest.setUpTestDataapps/projects/tests.py:836 cls.local_document = json.loads((SAMPLES / "local-tachyon.json").read_text())2 ms0.7%
loads<stdlib>/json/__init__.py:3712 ms0.7%
JSONDecoder.decode<stdlib>/json/decoder.py:3582 ms0.7%
JSONDecoder.raw_decode<stdlib>/json/decoder.py:3742 ms0.7%
1 smaller frames hidden
TestCase.setUpClassdjango/test/testcases.py:1423 cls.cls_atomics = cls._enter_atomics()9 ms3.0%
TestCase._enter_atomicsdjango/test/testcases.py:13969 ms3.0%
Atomic.__enter__django/db/transaction.py:1989 ms3.0%
BaseDatabaseWrapper.get_autocommitdjango/db/backends/base/base.py:4549 ms3.0%
SimpleTestCase.ensure_connection_patch_method.<locals>.patched_ensure_connectiondjango/test/testcases.py:3039 ms3.0%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:269 ms3.0%
BaseDatabaseWrapper.ensure_connectiondjango/db/backends/base/base.py:2799 ms3.0%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:269 ms3.0%
BaseDatabaseWrapper.connectdjango/db/backends/base/base.py:2569 ms3.0%
async_unsafe.<locals>.decorator.<locals>.innerdjango/utils/asyncio.py:269 ms3.0%
DatabaseWrapper.get_new_connectiondjango/db/backends/postgresql/base.py:3339 ms3.0%
Connection.connectpsycopg/connection.py:1098 ms2.6%
wait_connpsycopg/waiting.py:1415 ms1.5%
EpollSelector.select<stdlib>/selectors.py:4525 ms1.5%
wait_connpsycopg/waiting.py:1453 ms1.1%
BaseConnection._connect_genpsycopg/_connection_base.py:4393 ms1.1%
1 smaller frames hidden
1 smaller frames hidden
call17 ms5.6%
TransactionTestCase._post_teardowndjango/test/testcases.py:1240 self._fixture_teardown()9 ms3.1%
TestCase._fixture_teardowndjango/test/testcases.py:14959 ms3.1%
DatabaseWrapper.check_constraintsdjango/db/backends/postgresql/base.py:4839 ms3.1%
CursorWrapper.executedjango/db/backends/utils.py:799 ms3.1%
CursorWrapper._execute_with_wrappersdjango/db/backends/utils.py:929 ms3.1%
CursorWrapper._executedjango/db/backends/utils.py:1039 ms3.1%
Cursor.executepsycopg/cursor.py:1139 ms3.1%
Connection.waitpsycopg/connection.py:4959 ms3.1%
RealProfileDocumentTest.test_call_treeapps/projects/tests.py:860 entry = find_test_entry(self.local_document, self.nodeid)4 ms1.2%
TestData.__get__django/test/testcases.py:13674 ms1.2%
deepcopy<stdlib>/copy.py:1314 ms1.2%
_deepcopy_dict<stdlib>/copy.py:2024 ms1.2%
deepcopy<stdlib>/copy.py:1314 ms1.2%
_deepcopy_list<stdlib>/copy.py:1774 ms1.2%
deepcopy<stdlib>/copy.py:1314 ms1.2%
RealProfileDocumentTest.test_call_treeapps/projects/tests.py:8614 ms1.2%
build_call_treeapps/projects/profiles.py:5942 ms0.6%
build_call_treeapps/projects/profiles.py:6102 ms0.6%
CallNode.childapps/projects/profiles.py:5382 ms0.6%
__create_fn__.<locals>.__init__<string>:62 ms0.6%
<GC>~2 ms0.6%
Estimated from 263 samples; phase durations are exact. Frames from pytest and pluggy are
hidden
.
Hot lines in your code
|
apps/projects/profiles.py:112
return json.loads(gzip.decompress(bytes(part.document)))
load_document
· Serialization
|
170 ms |
|
apps/projects/profiles.py:108
return gzip.compress(data, compresslevel=6)
compress
· Libraries
|
12 ms |
|
apps/projects/profiles.py:313
cursor.executemany(SNAPSHOT_UPSERT, batch)
write_snapshots
· Database
|
9 ms |
|
apps/projects/models.py:466
super().save(*args, **kwargs)
Profile.save
· Database
|
7 ms |
|
apps/projects/tests.py:860
entry = find_test_entry(self.local_document, self.nodeid)
RealProfileDocumentTest.test_call_tree
· Deep copies
|
4 ms |
|
apps/projects/profiles.py:238
while isinstance(node, int) and 0 <= node < len(stacks) and node not in node_ids and len(path) <= len(stacks):
snapshot_document.<locals>.node_id
· App code
|
3 ms |
|
apps/projects/tests.py:835
cls.project = baker.make(Project)
RealProfileDocumentTest.setUpTestData
· Database
|
3 ms |
|
apps/projects/environments.py:63
obj, created = Environment.objects.get_or_create(
get_or_create_environment
· Database
|
3 ms |
|
apps/projects/profiles.py:383
commit, _ = Commit.objects.get_or_create(
claim_part
· Database
|
3 ms |
|
apps/projects/models.py:230
self.bulk_create( # sorted, so uploads sharing tests lock their rows in the same order
TestManager.upsert
· Database
|
3 ms |
Fixtures
Exact setup time| _unittest_setUpClass_fixture_RealProfileDocumentTest class | 285 ms |
| _django_setup_unittest class | 0.35 ms |
| _template_string_if_invalid_marker function | 0.06 ms |
| _dj_autoclear_mailbox function | 0.05 ms |
| _django_db_marker function | 0.05 ms |
| _django_set_urlconf function | 0.04 ms |
| _live_server_helper function | 0.03 ms |
| _django_clear_site_cache function | 0.03 ms |
| monkeypatch function | 0.02 ms |
Database
89 queries · 59 ms
Repeated queries are usually N+1 lookups: fetch them once with select_related / prefetch_related (or selectinload).
6×
SELECT "projects_profile"."id", "projects_profile"."project_id", "projects_profile"."number", "projects_profile"."environment_id", "projects_profile"."session_id", "projects_profile"."run_id", "projects_profile"."commit_id", "projects_profile"."ingest_id", "projects_profile"."external_id", "project…
4×
SELECT "projects_profilepart"."id", "projects_profilepart"."profile_id", "projects_profilepart"."index", "projects_profilepart"."count", "projects_profilepart"."checksum", "projects_profilepart"."status", "projects_profilepart"."error", "projects_profilepart"."tests_count", "projects_profilepart"."…
4×
SELECT "projects_environment"."id", "projects_environment"."project_id", "projects_environment"."name", "projects_environment"."kind", "projects_environment"."provider", "projects_environment"."details", "projects_environment"."date_first_seen", "projects_environment"."date_last_seen" FROM "project…
Biggest pieces of work
|
setup setUpClass
django/test/testcases.py:1439
|
285 ms |
|
call _post_teardown
django/test/testcases.py:1240
|
9 ms |
|
call test body
apps/projects/tests.py:860
|
7 ms |
|
setup __init__
__init__:-1
|
1 ms |
Reliability
5 results · 0 CI failures · 0 local failuresThis test hasn't failed recently.
History
Latest 5 results, oldest first in the strip| When | Environment | Outcome | Duration | |
|---|---|---|---|---|
| 18 minutes ago | CI github-actions:test | passed | 303 ms | Profile |
| 43 minutes ago | CI github-actions:test | passed | 281 ms | Profile |
| 7 hours ago | CI github-actions:test | passed | 183 ms | Profile |
| 7 hours ago | CI github-actions:test | passed | 239 ms | Profile |
| 7 hours ago | CI github-actions:test | passed | 163 ms | Profile |