Skip to content

Commit 8ccfb28

Browse files
committed
fix(ci): gracefully skip import_profile session if profiler script missing
1 parent 5eab435 commit 8ccfb28

291 files changed

Lines changed: 1576 additions & 631 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/bigframes/noxfile.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,14 +1097,20 @@ def mypy(session):
10971097
@nox.session(python="3.15")
10981098
def import_profile(session):
10991099
"""Ensure import times remain below defined thresholds."""
1100+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
1101+
if not profiler_script.exists():
1102+
session.skip("The import profiler script was not found.")
1103+
11001104
session.install(".")
1101-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
1102-
session.run("python", profiler_script, "--module", "unknown_module", "--iterations", "10")
1105+
session.run("python", str(profiler_script), "--module", "unknown_module", "--iterations", "10")
11031106

11041107

11051108
@nox.session(python="3.15")
11061109
def import_profile(session):
11071110
"""Ensure import times remain below defined thresholds."""
1111+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
1112+
if not profiler_script.exists():
1113+
session.skip("The import profiler script was not found.")
1114+
11081115
session.install(".")
1109-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
1110-
session.run("python", profiler_script, "--module", "unknown_module", "--iterations", "10")
1116+
session.run("python", str(profiler_script), "--module", "unknown_module", "--iterations", "10")

packages/bigquery-magics/noxfile.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,14 +551,20 @@ def mypy(session):
551551
@nox.session(python="3.15")
552552
def import_profile(session):
553553
"""Ensure import times remain below defined thresholds."""
554+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
555+
if not profiler_script.exists():
556+
session.skip("The import profiler script was not found.")
557+
554558
session.install(".")
555-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
556-
session.run("python", profiler_script, "--module", "unknown_module", "--iterations", "10")
559+
session.run("python", str(profiler_script), "--module", "unknown_module", "--iterations", "10")
557560

558561

559562
@nox.session(python="3.15")
560563
def import_profile(session):
561564
"""Ensure import times remain below defined thresholds."""
565+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
566+
if not profiler_script.exists():
567+
session.skip("The import profiler script was not found.")
568+
562569
session.install(".")
563-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
564-
session.run("python", profiler_script, "--module", "unknown_module", "--iterations", "10")
570+
session.run("python", str(profiler_script), "--module", "unknown_module", "--iterations", "10")

packages/db-dtypes/noxfile.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,14 +552,20 @@ def mypy(session):
552552
@nox.session(python="3.15")
553553
def import_profile(session):
554554
"""Ensure import times remain below defined thresholds."""
555+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
556+
if not profiler_script.exists():
557+
session.skip("The import profiler script was not found.")
558+
555559
session.install(".")
556-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
557-
session.run("python", profiler_script, "--module", "db_dtypes", "--iterations", "10")
560+
session.run("python", str(profiler_script), "--module", "db_dtypes", "--iterations", "10")
558561

559562

560563
@nox.session(python="3.15")
561564
def import_profile(session):
562565
"""Ensure import times remain below defined thresholds."""
566+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
567+
if not profiler_script.exists():
568+
session.skip("The import profiler script was not found.")
569+
563570
session.install(".")
564-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
565-
session.run("python", profiler_script, "--module", "db_dtypes", "--iterations", "10")
571+
session.run("python", str(profiler_script), "--module", "db_dtypes", "--iterations", "10")

packages/django-google-spanner/noxfile.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,14 +496,20 @@ def format(session: nox.sessions.Session) -> None:
496496
@nox.session(python="3.15")
497497
def import_profile(session):
498498
"""Ensure import times remain below defined thresholds."""
499+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
500+
if not profiler_script.exists():
501+
session.skip("The import profiler script was not found.")
502+
499503
session.install(".")
500-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
501-
session.run("python", profiler_script, "--module", "unknown_module", "--iterations", "10")
504+
session.run("python", str(profiler_script), "--module", "unknown_module", "--iterations", "10")
502505

503506

504507
@nox.session(python="3.15")
505508
def import_profile(session):
506509
"""Ensure import times remain below defined thresholds."""
510+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
511+
if not profiler_script.exists():
512+
session.skip("The import profiler script was not found.")
513+
507514
session.install(".")
508-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
509-
session.run("python", profiler_script, "--module", "unknown_module", "--iterations", "10")
515+
session.run("python", str(profiler_script), "--module", "unknown_module", "--iterations", "10")

packages/gapic-generator/gapic/templates/noxfile.py.j2

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,11 +647,14 @@ def core_deps_from_source(session, protobuf_implementation):
647647
@nox.session(python="3.15")
648648
def import_profile(session):
649649
"""Ensure import times remain below defined thresholds."""
650+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
651+
if not profiler_script.exists():
652+
session.skip("The import profiler script was not found.")
653+
650654
session.install(".")
651-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
652655
{% if api.naming.module_namespace %}
653-
session.run("python", profiler_script, "--module", "{{ api.naming.module_namespace[0] }}", "--iterations", "10")
656+
session.run("python", str(profiler_script), "--module", "{{ api.naming.module_namespace[0] }}", "--iterations", "10")
654657
{% else %}
655-
session.run("python", profiler_script, "--module", "{{ api.naming.versioned_module_name }}", "--iterations", "10")
658+
session.run("python", str(profiler_script), "--module", "{{ api.naming.versioned_module_name }}", "--iterations", "10")
656659
{% endif %}
657660
{% endblock %}

packages/gapic-generator/noxfile.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -852,14 +852,20 @@ def core_deps_from_source(session, protobuf_implementation):
852852
@nox.session(python="3.15")
853853
def import_profile(session):
854854
"""Ensure import times remain below defined thresholds."""
855+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
856+
if not profiler_script.exists():
857+
session.skip("The import profiler script was not found.")
858+
855859
session.install(".")
856-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
857-
session.run("python", profiler_script, "--module", "google", "--iterations", "10")
860+
session.run("python", str(profiler_script), "--module", "google", "--iterations", "10")
858861

859862

860863
@nox.session(python="3.15")
861864
def import_profile(session):
862865
"""Ensure import times remain below defined thresholds."""
866+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
867+
if not profiler_script.exists():
868+
session.skip("The import profiler script was not found.")
869+
863870
session.install(".")
864-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
865-
session.run("python", profiler_script, "--module", "google", "--iterations", "10")
871+
session.run("python", str(profiler_script), "--module", "google", "--iterations", "10")

packages/gapic-generator/tests/integration/goldens/asset/noxfile.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,9 @@ def core_deps_from_source(session, protobuf_implementation):
639639
@nox.session(python="3.15")
640640
def import_profile(session):
641641
"""Ensure import times remain below defined thresholds."""
642+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
643+
if not profiler_script.exists():
644+
session.skip("The import profiler script was not found.")
645+
642646
session.install(".")
643-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
644-
session.run("python", profiler_script, "--module", "google", "--iterations", "10")
647+
session.run("python", str(profiler_script), "--module", "google", "--iterations", "10")

packages/gapic-generator/tests/integration/goldens/credentials/noxfile.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,9 @@ def core_deps_from_source(session, protobuf_implementation):
639639
@nox.session(python="3.15")
640640
def import_profile(session):
641641
"""Ensure import times remain below defined thresholds."""
642+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
643+
if not profiler_script.exists():
644+
session.skip("The import profiler script was not found.")
645+
642646
session.install(".")
643-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
644-
session.run("python", profiler_script, "--module", "google", "--iterations", "10")
647+
session.run("python", str(profiler_script), "--module", "google", "--iterations", "10")

packages/gapic-generator/tests/integration/goldens/eventarc/noxfile.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,9 @@ def core_deps_from_source(session, protobuf_implementation):
639639
@nox.session(python="3.15")
640640
def import_profile(session):
641641
"""Ensure import times remain below defined thresholds."""
642+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
643+
if not profiler_script.exists():
644+
session.skip("The import profiler script was not found.")
645+
642646
session.install(".")
643-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
644-
session.run("python", profiler_script, "--module", "google", "--iterations", "10")
647+
session.run("python", str(profiler_script), "--module", "google", "--iterations", "10")

packages/gapic-generator/tests/integration/goldens/logging/noxfile.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,9 @@ def core_deps_from_source(session, protobuf_implementation):
639639
@nox.session(python="3.15")
640640
def import_profile(session):
641641
"""Ensure import times remain below defined thresholds."""
642+
profiler_script = CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
643+
if not profiler_script.exists():
644+
session.skip("The import profiler script was not found.")
645+
642646
session.install(".")
643-
profiler_script = os.path.join(CURRENT_DIRECTORY.parent.parent, "scripts", "import_profiler", "profiler.py")
644-
session.run("python", profiler_script, "--module", "google", "--iterations", "10")
647+
session.run("python", str(profiler_script), "--module", "google", "--iterations", "10")

0 commit comments

Comments
 (0)