-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Derek furst/sync component datasets #646
Changes from 8 commits
88727f3
cc29504
795b63d
b055ee8
19b9587
53dfdb7
f65b0bc
4bd1561
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: Python application | ||
on: | ||
push: | ||
branches: [ "main", "dev-integrate" ] | ||
pull_request: | ||
branches: [ "main", "dev-integrate" ] | ||
permissions: | ||
contents: read | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.9" | ||
- name: Upgrade Pip | ||
run: python -m pip install --upgrade pip | ||
working-directory: src | ||
- name: Install Dependencies | ||
run: pip install -r requirements.txt | ||
working-directory: src |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -31,6 +31,7 @@ | |||||||||||||||||||||||||||
_schema = None | ||||||||||||||||||||||||||||
_uuid_api_url = None | ||||||||||||||||||||||||||||
_ingest_api_url = None | ||||||||||||||||||||||||||||
_entity_api_url = None | ||||||||||||||||||||||||||||
_ontology_api_url = None | ||||||||||||||||||||||||||||
_auth_helper = None | ||||||||||||||||||||||||||||
_neo4j_driver = None | ||||||||||||||||||||||||||||
|
@@ -69,6 +70,7 @@ def initialize(valid_yaml_file, | |||||||||||||||||||||||||||
uuid_api_url, | ||||||||||||||||||||||||||||
ingest_api_url, | ||||||||||||||||||||||||||||
ontology_api_url, | ||||||||||||||||||||||||||||
entity_api_url, | ||||||||||||||||||||||||||||
auth_helper_instance, | ||||||||||||||||||||||||||||
neo4j_driver_instance, | ||||||||||||||||||||||||||||
memcached_client_instance, | ||||||||||||||||||||||||||||
|
@@ -78,6 +80,7 @@ def initialize(valid_yaml_file, | |||||||||||||||||||||||||||
global _uuid_api_url | ||||||||||||||||||||||||||||
global _ingest_api_url | ||||||||||||||||||||||||||||
global _ontology_api_url | ||||||||||||||||||||||||||||
global _entity_api_url | ||||||||||||||||||||||||||||
global _auth_helper | ||||||||||||||||||||||||||||
global _neo4j_driver | ||||||||||||||||||||||||||||
global _memcached_client | ||||||||||||||||||||||||||||
|
@@ -105,6 +108,12 @@ def initialize(valid_yaml_file, | |||||||||||||||||||||||||||
logger.critical(msg=msg) | ||||||||||||||||||||||||||||
raise Exception(msg) | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
if entity_api_url is not None: | ||||||||||||||||||||||||||||
_entity_api_url = entity_api_url | ||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||
msg = f"Unable to initialize schema manager with entity_api_url={entity_api_url}." | ||||||||||||||||||||||||||||
logger.critical(msg=msg) | ||||||||||||||||||||||||||||
raise Exception(msg) | ||||||||||||||||||||||||||||
# Get the helper instances | ||||||||||||||||||||||||||||
_auth_helper = auth_helper_instance | ||||||||||||||||||||||||||||
_neo4j_driver = neo4j_driver_instance | ||||||||||||||||||||||||||||
|
@@ -507,6 +516,25 @@ def remove_transient_and_none_values(merged_dict, normalized_entity_type): | |||||||||||||||||||||||||||
return filtered_dict | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||
Update entity via HTTP call to entity-api | ||||||||||||||||||||||||||||
This is useful when a change in one entity necessitates changes in another, while allowing the normal triggers | ||||||||||||||||||||||||||||
and validators to execute | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
Parameters | ||||||||||||||||||||||||||||
---------- | ||||||||||||||||||||||||||||
uuid : string | ||||||||||||||||||||||||||||
The uuid of the entity being updated | ||||||||||||||||||||||||||||
data : dict | ||||||||||||||||||||||||||||
A dict representation of the json_data_dict for the updated entity | ||||||||||||||||||||||||||||
token : string | ||||||||||||||||||||||||||||
The globus groups token | ||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||
def update_entity(uuid, data, token): | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of defining this We should add a getter method similar to entity-api/src/schema/schema_manager.py Lines 1690 to 1701 in 795b63d
so other modules can get a handle of the entity-api url and then make request inside the trigger method like this entity-api/src/schema/schema_triggers.py Line 1390 in 795b63d
|
||||||||||||||||||||||||||||
url = _entity_api_url + SchemaConstants.ENTITY_API_UPDATE_ENDPOINT + '/' + uuid | ||||||||||||||||||||||||||||
header = _create_request_headers(token) | ||||||||||||||||||||||||||||
header[schemaConstants.HUBMAP_APP_HEADER] = INGEST_API_APP | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't test, at a quick glance |
||||||||||||||||||||||||||||
response = requests.put(url=url, headers=header, json=data) | ||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||
Generate the complete entity record by running the read triggers | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though this is instructional, we should use localhost URL rather than DEV. Add some comment to explain this is the same URL base where the entity-api is running. Because if someone uses the DEV URL and runs the entity-api locally, it'll end up updating the component datasets in DEV neo4j from the local trigger requests. The key is to keep it consistent. And once deployed on DEV/TEST/PROD, we can still use a
localhost:port
where the entity-api runs on the VM.