nci-cidc-api-modules 1.2.36__py3-none-any.whl → 1.2.39__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cidc_api/__init__.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = "1.2.39"
cidc_api/models/models.py CHANGED
@@ -3478,6 +3478,7 @@ class IngestionJobs(CommonColumns):
3478
3478
  batch_id = Column(String, nullable=True)
3479
3479
  submission_id = Column(String, nullable=True)
3480
3480
  intake_path = Column(String, nullable=True)
3481
+ uploader_email = Column(String, nullable=True)
3481
3482
 
3482
3483
  @staticmethod
3483
3484
  @with_default_session
@@ -3493,6 +3494,7 @@ class IngestionJobs(CommonColumns):
3493
3494
  submission_id: str = None,
3494
3495
  intake_path: str = None,
3495
3496
  start_date: datetime = None,
3497
+ uploader_email: str = None,
3496
3498
  session: Session = None,
3497
3499
  ):
3498
3500
  new_job = IngestionJobs(
@@ -3507,6 +3509,7 @@ class IngestionJobs(CommonColumns):
3507
3509
  submission_id=submission_id,
3508
3510
  intake_path=intake_path,
3509
3511
  start_date=start_date,
3512
+ uploader_email=uploader_email,
3510
3513
  )
3511
3514
  new_job.insert(session=session)
3512
3515
  return new_job
cidc_api/telemetry.py ADDED
@@ -0,0 +1,101 @@
1
+ # standard modules
2
+ from functools import wraps
3
+
4
+ # external modules
5
+ from opentelemetry import trace
6
+ from opentelemetry.sdk.resources import Resource
7
+ from opentelemetry.sdk.trace import TracerProvider
8
+ from opentelemetry.sdk.trace.export import BatchSpanProcessor
9
+
10
+ # local modules
11
+ from .config.settings import ENV, TESTING
12
+
13
+ # pylint: disable=import-outside-toplevel
14
+
15
+
16
+ def instrument_flask(app):
17
+ from opentelemetry.instrumentation.flask import FlaskInstrumentor
18
+ from opentelemetry.propagate import set_global_textmap
19
+ from opentelemetry.propagators.cloud_trace_propagator import CloudTraceFormatPropagator
20
+
21
+ FlaskInstrumentor().instrument_app(app)
22
+
23
+ # use the X-Cloud-Trace-Context header
24
+ set_global_textmap(CloudTraceFormatPropagator())
25
+
26
+
27
+ def instrument_requests():
28
+ from opentelemetry.instrumentation.requests import RequestsInstrumentor
29
+
30
+ def _request_hook(span, request_obj):
31
+ span.update_name(f"requests {request_obj.method}")
32
+
33
+ RequestsInstrumentor().instrument(request_hook=_request_hook)
34
+
35
+
36
+ def instrument_sqlachemy(engine):
37
+ from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
38
+
39
+ SQLAlchemyInstrumentor().instrument(engine=engine)
40
+
41
+
42
+ resource = Resource(attributes={"service.name": f"CIDC-{ENV}"})
43
+ provider = TracerProvider(resource=resource)
44
+
45
+
46
+ if ENV == "dev" and not TESTING:
47
+ from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
48
+
49
+ COLLECTOR_ENDPOINT = "127.0.0.1"
50
+ COLLECTOR_GRPC_PORT = 6004
51
+
52
+ # send spans to local exporter
53
+ # 1. download latest version from https://github.com/open-telemetry/opentelemetry-collector-releases/releases (otelcol-contrib_0.140.1_darwin_arm64)
54
+ # 2. start exporter from otel folder with `./otelcol-contrib --config=config.yaml`
55
+ # 3. download and start Jeager (all-in-one image) - https://www.jaegertracing.io/download/
56
+ exporter = OTLPSpanExporter(endpoint=f"http://{COLLECTOR_ENDPOINT}:{COLLECTOR_GRPC_PORT}", insecure=True)
57
+ processor = BatchSpanProcessor(exporter)
58
+ provider.add_span_processor(processor)
59
+
60
+ if ENV == "dev-int":
61
+ from opentelemetry.exporter.cloud_trace import CloudTraceSpanExporter
62
+
63
+ # send span to Cloud Trace service - https://console.cloud.google.com/traces/explorer
64
+ exporter = CloudTraceSpanExporter()
65
+ processor = BatchSpanProcessor(exporter)
66
+ provider.add_span_processor(processor)
67
+
68
+
69
+ # NOTE: we don't run telemetry in upper tiers; no span processor is noop
70
+
71
+ trace.set_tracer_provider(provider)
72
+ tracer = trace.get_tracer(__name__)
73
+
74
+
75
+ def trace_(*args):
76
+ def decorator_factory(func):
77
+
78
+ @wraps(func)
79
+ def wrapper(*args_, **kwargs_):
80
+ func_name = f"{func.__module__.split(".")[-1]}.{func.__name__}"
81
+
82
+ with tracer.start_as_current_span(func_name) as span:
83
+ for arg in args:
84
+ value = kwargs_.get(arg)
85
+
86
+ # track id of argument if exists
87
+ if hasattr(value, "id"):
88
+ value = getattr(value, "id")
89
+
90
+ span.set_attributes({arg: value})
91
+
92
+ result = func(*args_, **kwargs_)
93
+
94
+ if isinstance(result, (str, int, float, bool)):
95
+ span.set_attribute("result", result)
96
+
97
+ return result
98
+
99
+ return wrapper
100
+
101
+ return decorator_factory
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nci_cidc_api_modules
3
- Version: 1.2.36
3
+ Version: 1.2.39
4
4
  Summary: SQLAlchemy data models and configuration tools used in the NCI CIDC API
5
5
  Home-page: https://github.com/NCI-CIDC/cidc-api-gae
6
6
  License: MIT license
@@ -8,34 +8,34 @@ Requires-Python: >=3.13
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
10
  Requires-Dist: certifi>=2025.11.12
11
- Requires-Dist: cloud-sql-python-connector[pg8000]>=1.18.5
11
+ Requires-Dist: cloud-sql-python-connector[pg8000]>=1.19.0
12
12
  Requires-Dist: flask>=3.1.2
13
13
  Requires-Dist: flask-migrate>=4.1.0
14
14
  Requires-Dist: flask-sqlalchemy>=3.1.1
15
15
  Requires-Dist: flask-talisman>=0.7.0
16
- Requires-Dist: google-auth==2.43.0
16
+ Requires-Dist: google-auth==2.45.0
17
17
  Requires-Dist: google-api-python-client>=2.187.0
18
- Requires-Dist: google-cloud-bigquery>=3.38.0
19
- Requires-Dist: google-cloud-pubsub>=2.33.0
20
- Requires-Dist: google-cloud-secret-manager>=2.25.0
21
- Requires-Dist: google-cloud-storage>=3.6.0
18
+ Requires-Dist: google-cloud-bigquery>=3.39.0
19
+ Requires-Dist: google-cloud-pubsub>=2.34.0
20
+ Requires-Dist: google-cloud-secret-manager>=2.26.0
21
+ Requires-Dist: google-cloud-storage>=3.7.0
22
22
  Requires-Dist: jinja2>=3.1.6
23
- Requires-Dist: joserfc>=1.5.0
24
- Requires-Dist: marshmallow>=4.1.0
23
+ Requires-Dist: joserfc>=1.6.0
24
+ Requires-Dist: marshmallow>=4.1.2
25
25
  Requires-Dist: marshmallow-sqlalchemy>=1.4.2
26
- Requires-Dist: numpy>=2.3.5
26
+ Requires-Dist: numpy>=2.4.0
27
27
  Requires-Dist: packaging>=25.0
28
28
  Requires-Dist: pandas>=2.3.3
29
29
  Requires-Dist: pyarrow>=22.0.0
30
30
  Requires-Dist: pydantic~=2.12.5
31
31
  Requires-Dist: python-dotenv>=1.2.1
32
32
  Requires-Dist: requests>=2.32.5
33
- Requires-Dist: sqlalchemy>=2.0.44
33
+ Requires-Dist: sqlalchemy>=2.0.45
34
34
  Requires-Dist: sqlalchemy-mixins~=2.0.5
35
35
  Requires-Dist: werkzeug>=3.1.4
36
- Requires-Dist: opentelemetry-api>=1.38.0
37
- Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.38.0
38
- Requires-Dist: opentelemetry-sdk>=1.38.0
36
+ Requires-Dist: opentelemetry-api>=1.39.1
37
+ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.39.1
38
+ Requires-Dist: opentelemetry-sdk>=1.39.1
39
39
  Requires-Dist: opentelemetry-instrumentation-flask>=0.59b0
40
40
  Requires-Dist: opentelemetry-instrumentation-requests>=0.59b0
41
41
  Requires-Dist: opentelemetry-instrumentation-sqlalchemy>=0.59b0
@@ -1,3 +1,5 @@
1
+ cidc_api/__init__.py,sha256=-YGSx2TBmytNvZuuZBF4IMYrZU5cQnr5VfDEpKUnxb0,23
2
+ cidc_api/telemetry.py,sha256=LuZWkG8CKCn23O41RTNxEOQwMmfpp-fQ6zSInZhVJg8,3333
1
3
  cidc_api/config/__init__.py,sha256=5mX8GAPxUKV84iS-aGOoE-4m68LsOCGCDptXNdlgvj0,148
2
4
  cidc_api/config/db.py,sha256=CRgpyw7uVP9v7CTAa7_1dcXURqrfjRcLNjGgZC7iPQE,1627
3
5
  cidc_api/config/logging.py,sha256=abhVYtn8lfhIt0tyV2WHFgSmp_s2eeJh7kodB6LH4J0,1149
@@ -6,7 +8,7 @@ cidc_api/config/settings.py,sha256=ttOGvk_6zVMn4dtxIZ2-0w3wF2fpAUVfGpVZbKJ2b6s,4
6
8
  cidc_api/models/__init__.py,sha256=cTyK0Z1ttLo9itwZVRFr-d6aX-zX633YhqipqPgoGfE,115
7
9
  cidc_api/models/data.py,sha256=uLkgAJ6tCtsi3bOGt8I9esYrZqgbsTYM1rGfL2gx5sY,837
8
10
  cidc_api/models/migrations.py,sha256=UlS5How3J4ryaRuZT6F5VQtAKikkl0LTv9MgMO_ltiQ,11161
9
- cidc_api/models/models.py,sha256=QLVxftl9vEgHEPA5au0lh2usTTsh5lI8vWjuS2Twxdk,152921
11
+ cidc_api/models/models.py,sha256=p0_8AgWaQ_6PW8BrMLm-7sil5NReXZfgYuWLLYfNH9A,153051
10
12
  cidc_api/models/schemas.py,sha256=6IE2dJoEMcMbi0Vr1V3cYKnPKU0hv9vRKBixOZHe88s,2766
11
13
  cidc_api/models/types.py,sha256=nq_PvzDz67HzceOI_ve9AxReExAZ-XFE7T3G2bbpqJ4,29667
12
14
  cidc_api/models/db/base_orm.py,sha256=EV78qFBcOR7spK_PhjbkpsGcmcP33AQItX61SidDa_8,813
@@ -103,8 +105,8 @@ cidc_api/shared/gcloud_client.py,sha256=fDNgRpU7jAeDtYfY-Zz09KE-__jHo6v0J7fI3eLg
103
105
  cidc_api/shared/jose.py,sha256=-qzGzEDAlokEp9E7WtBtQkXyyfPWTYXlwYpCqVJWmqM,1830
104
106
  cidc_api/shared/rest_utils.py,sha256=RwR30WOUAYCxL7V-i2totEyeriG30GbBDvBcpLXhM9w,6594
105
107
  cidc_api/shared/utils.py,sha256=Po14K_7cvMKI9zJVzS0YDP1IqDBQS5Mvs6UMvS0RT4g,328
106
- nci_cidc_api_modules-1.2.36.dist-info/licenses/LICENSE,sha256=pNYWVTHaYonnmJyplmeAp7tQAjosmDpAWjb34jjv7Xs,1102
107
- nci_cidc_api_modules-1.2.36.dist-info/METADATA,sha256=94lsTOKAtCJgZoANklikdDqfp-R7UQoU2qCOobI2sHI,40229
108
- nci_cidc_api_modules-1.2.36.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
109
- nci_cidc_api_modules-1.2.36.dist-info/top_level.txt,sha256=rNiRzL0lJGi5Q9tY9uSoMdTbJ-7u5c_D2E86KA94yRA,9
110
- nci_cidc_api_modules-1.2.36.dist-info/RECORD,,
108
+ nci_cidc_api_modules-1.2.39.dist-info/licenses/LICENSE,sha256=pNYWVTHaYonnmJyplmeAp7tQAjosmDpAWjb34jjv7Xs,1102
109
+ nci_cidc_api_modules-1.2.39.dist-info/METADATA,sha256=C_EZkWucWYx5taqgp0jwNwcQc41WNM9aM2_G6V9uFws,40229
110
+ nci_cidc_api_modules-1.2.39.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
111
+ nci_cidc_api_modules-1.2.39.dist-info/top_level.txt,sha256=rNiRzL0lJGi5Q9tY9uSoMdTbJ-7u5c_D2E86KA94yRA,9
112
+ nci_cidc_api_modules-1.2.39.dist-info/RECORD,,