Skip to content

Commit 1bef8d7

Browse files
authored
Merge branch 'develop' into develop-modify-precommit
2 parents ca629a2 + 4795cd1 commit 1bef8d7

21 files changed

+1186
-383
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
run: |
9191
# ran only on certain files for now
9292
# add here when checked
93-
poetry run black schematic --check
93+
poetry run black schematic tests schematic_api --check
9494
9595
#----------------------------------------------
9696
# type checking/enforcement

.pre-commit-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ repos:
1010
# pre-commit's default_language_version, see
1111
# https://pre-commit.com/#top_level-default_language_version
1212
language_version: python3.10
13-
files: schematic/
13+
files: ^(tests|schematic|schematic_api)/
1414

1515
- repo: https://github.com/pycqa/isort
1616
rev: 5.13.2
1717
hooks:
1818
- id: isort
19-
name: isort (python)
19+
name: isort (python)
20+
files: ^(tests|schematic|schematic_api)/

poetry.lock

Lines changed: 120 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pygsheets = "^2.0.4"
5454
PyYAML = "^6.0.0"
5555
rdflib = "^6.0.0"
5656
setuptools = "^66.0.0"
57-
synapseclient = "^4.1.0"
57+
synapseclient = "^4.3.0"
5858
tenacity = "^8.0.1"
5959
toml = "^0.10.2"
6060
great-expectations = "^0.15.0"
@@ -74,9 +74,13 @@ Flask = {version = "2.1.3", optional = true}
7474
Flask-Cors = {version = "^3.0.10", optional = true}
7575
uWSGI = {version = "^2.0.21", optional = true}
7676
Jinja2 = {version = ">2.11.3", optional = true}
77+
asyncio = "^3.4.3"
78+
pytest-asyncio = "^0.23.7"
79+
jaeger-client = {version = "^4.8.0", optional = true}
80+
flask-opentracing = {version="^2.0.0", optional = true}
7781

7882
[tool.poetry.extras]
79-
api = ["connexion", "Flask", "Flask-Cors", "Jinja2", "pyopenssl"]
83+
api = ["connexion", "Flask", "Flask-Cors", "Jinja2", "pyopenssl", "jaeger-client", "flask-opentracing"]
8084
aws = ["uWSGI"]
8185

8286

schematic/manifest/generator.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@
3232
from schematic.configuration.configuration import CONFIG
3333
from schematic.utils.google_api_utils import export_manifest_drive_service
3434

35+
from opentelemetry import trace
3536

3637
logger = logging.getLogger(__name__)
38+
tracer = trace.get_tracer("Schematic")
3739

3840

3941
class ManifestGenerator(object):
@@ -1289,6 +1291,7 @@ def _gather_all_fields(self, fields, json_schema):
12891291
)
12901292
return required_metadata_fields
12911293

1294+
@tracer.start_as_current_span("ManifestGenerator::get_empty_manifest")
12921295
def get_empty_manifest(
12931296
self,
12941297
strict: Optional[bool],
@@ -1334,6 +1337,7 @@ def _get_missing_columns(self, headers_1: list, headers_2: list) -> list:
13341337
"""
13351338
return set(headers_1) - set(headers_2)
13361339

1340+
@tracer.start_as_current_span("ManifestGenerator::set_dataframe_by_url")
13371341
def set_dataframe_by_url(
13381342
self,
13391343
manifest_url: str,
@@ -1425,6 +1429,7 @@ def map_annotation_names_to_display_names(
14251429
# Use the above dictionary to rename columns in question
14261430
return annotations.rename(columns=label_map)
14271431

1432+
@tracer.start_as_current_span("ManifestGenerator::get_manifest_with_annotations")
14281433
def get_manifest_with_annotations(
14291434
self, annotations: pd.DataFrame, strict: Optional[bool] = None
14301435
) -> Tuple[ps.Spreadsheet, pd.DataFrame]:
@@ -1465,6 +1470,7 @@ def get_manifest_with_annotations(
14651470

14661471
return manifest_url, manifest_df
14671472

1473+
@tracer.start_as_current_span("ManifestGenerator::export_sheet_to_excel")
14681474
def export_sheet_to_excel(
14691475
self, title: str = None, manifest_url: str = None, output_location: str = None
14701476
) -> str:
@@ -1514,6 +1520,7 @@ def export_sheet_to_excel(
15141520

15151521
return output_excel_file_path
15161522

1523+
@tracer.start_as_current_span("ManifestGenerator::_handle_output_format_logic")
15171524
def _handle_output_format_logic(
15181525
self,
15191526
output_format: str = None,
@@ -1570,6 +1577,7 @@ def _handle_output_format_logic(
15701577
return dataframe
15711578

15721579
@staticmethod
1580+
@tracer.start_as_current_span("ManifestGenerator::create_single_manifest")
15731581
def create_single_manifest(
15741582
path_to_data_model: str,
15751583
graph_data_model: nx.MultiDiGraph,
@@ -1623,6 +1631,7 @@ def create_single_manifest(
16231631
return result
16241632

16251633
@staticmethod
1634+
@tracer.start_as_current_span("ManifestGenerator::create_manifests")
16261635
def create_manifests(
16271636
path_to_data_model: str,
16281637
data_types: list,
@@ -1751,6 +1760,7 @@ def create_manifests(
17511760

17521761
return all_results
17531762

1763+
@tracer.start_as_current_span("ManifestGenerator::get_manifest")
17541764
def get_manifest(
17551765
self,
17561766
dataset_id: str = None,
@@ -1998,6 +2008,9 @@ def _format_new_excel_column(self, worksheet, new_column_index: int, col: str):
19982008
)
19992009
return worksheet
20002010

2011+
@tracer.start_as_current_span(
2012+
"ManifestGenerator::populate_existing_excel_spreadsheet"
2013+
)
20012014
def populate_existing_excel_spreadsheet(
20022015
self, existing_excel_path: str = None, additional_df: pd.DataFrame = None
20032016
):

schematic/models/metadata.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
from schematic.utils.df_utils import load_df
2020

2121
from schematic.models.validate_manifest import validate_all
22+
from opentelemetry import trace
2223

2324
logger = logging.getLogger(__name__)
2425

26+
tracer = trace.get_tracer("Schematic")
27+
2528

2629
class MetadataModel(object):
2730
"""Metadata model wrapper around schema.org specification graph.
@@ -317,6 +320,7 @@ def populateModelManifest(
317320
manifestPath, emptyManifestURL, return_excel=return_excel, title=title
318321
)
319322

323+
@tracer.start_as_current_span("MetadataModel::submit_metadata_manifest")
320324
def submit_metadata_manifest( # pylint: disable=too-many-arguments, too-many-locals
321325
self,
322326
manifest_path: str,

0 commit comments

Comments
 (0)