Skip to content

Commit 0d2527a

Browse files
authored
Merge pull request #1454 from Sage-Bionetworks/develop
Schematic 24.7.1 Release
2 parents 728e717 + 3f4185d commit 0d2527a

39 files changed

+2074
-1342
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
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
@@ -101,7 +101,7 @@ jobs:
101101
# add here when checked
102102
# poetry run mypy --install-types --non-interactive
103103
# add here when enforced
104-
poetry run mypy --disallow-untyped-defs --install-types --non-interactive schematic/configuration/*.py schematic/exceptions.py schematic/help.py schematic/loader.py schematic/version.py schematic/visualization schematic/utils/
104+
poetry run mypy --disallow-untyped-defs --install-types --non-interactive schematic/schemas/ schematic/configuration/ schematic/exceptions.py schematic/help.py schematic/loader.py schematic/version.py schematic/visualization schematic/utils/
105105
106106
#----------------------------------------------
107107
# linting

.pre-commit-config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,12 @@ 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)/
14+
15+
- repo: https://github.com/pycqa/isort
16+
rev: 5.13.2
17+
hooks:
18+
- id: isort
19+
name: isort (python)
20+
files: ^(tests|schematic|schematic_api)/
21+
args: ["--profile", "black", "--filter-files"]

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ model:
141141
142142
# This section is for using google sheets with Schematic
143143
google_sheets:
144-
# The Synapse id of the Google service account credentials.
145-
service_acct_creds_synapse_id: "syn25171627"
146144
# Path to the synapse config file, either absolute or relative to this file
147145
service_acct_creds: "schematic_service_account_creds.json"
148146
# When doing google sheet validation (regex match) with the validation rules.

config_example.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ model:
3535

3636
# This section is for using google sheets with Schematic
3737
google_sheets:
38-
# The Synapse id of the Google service account credentials.
39-
service_acct_creds_synapse_id: "syn25171627"
4038
# Path to the synapse config file, either absolute or relative to this file
4139
service_acct_creds: "schematic_service_account_creds.json"
4240
# When doing google sheet validation (regex match) with the validation rules.

poetry.lock

Lines changed: 866 additions & 729 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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ graphviz = "^0.20.0"
4747
inflection = "^0.5.1"
4848
jsonschema = "^4.0.0"
4949
networkx = ">=2.2.8"
50-
numpy = "^1.21.1"
50+
numpy = "^1.26.4"
5151
oauth2client = "^4.1.0" # Specified because of bug in version ^4.0.0
52-
pandas = "^2.0.0"
52+
pandas = "^2.2.2"
5353
pygsheets = "^2.0.4"
5454
PyYAML = "^6.0.0"
5555
rdflib = "^6.0.0"
@@ -67,16 +67,18 @@ dateparser = "^1.1.4"
6767
pandarallel = "^1.6.4"
6868
schematic-db = {version = "0.0.41", extras = ["synapse"]}
6969
pyopenssl = {version = "^23.0.0", optional = true}
70-
typing-extensions = "<4.6.0"
7170
dataclasses-json = "^0.6.1"
71+
pydantic = "^1.10.4"
7272
connexion = {extras = ["swagger-ui"], version = "^2.8.0", optional = true}
7373
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+
jaeger-client = {version = "^4.8.0", optional = true}
78+
flask-opentracing = {version="^2.0.0", optional = true}
7779

7880
[tool.poetry.extras]
79-
api = ["connexion", "Flask", "Flask-Cors", "Jinja2", "pyopenssl"]
81+
api = ["connexion", "Flask", "Flask-Cors", "Jinja2", "pyopenssl", "jaeger-client", "flask-opentracing"]
8082
aws = ["uWSGI"]
8183

8284

schematic/configuration/configuration.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,6 @@ def model_location(self) -> str:
164164
"""
165165
return self._model_config.location
166166

167-
@property
168-
def service_account_credentials_synapse_id(self) -> str:
169-
"""
170-
Returns:
171-
str: The Synapse id of the Google service account credentials.
172-
"""
173-
return self._google_sheets_config.service_acct_creds_synapse_id
174-
175167
@property
176168
def service_account_credentials_path(self) -> str:
177169
"""

schematic/configuration/dataclasses.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,10 @@ class GoogleSheetsConfig:
124124
strict_validation: When doing google sheet validation (regex match) with the validation rules.
125125
True is alerting the user and not allowing entry of bad values.
126126
False is warning but allowing the entry on to the sheet.
127-
service_acct_creds_synapse_id: The Synapse id of the Google service account credentials.
128127
service_acct_creds: Path to the Google service account credentials,
129128
either absolute or relative to this file
130129
"""
131130

132-
service_acct_creds_synapse_id: str = "syn25171627"
133131
service_acct_creds: str = "schematic_service_account_creds.json"
134132
strict_validation: bool = True
135133

@@ -151,7 +149,6 @@ def validate_string_is_not_empty(cls, value: str) -> str:
151149
raise ValueError(f"{value} is an empty string")
152150
return value
153151

154-
@validator("service_acct_creds_synapse_id")
155152
@classmethod
156153
def validate_synapse_id(cls, value: str) -> str:
157154
"""Check if string is a valid synapse id

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)