-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into patch-318
- Loading branch information
Showing
238 changed files
with
1,038 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Run through all the FACILITY.yaml files and check that they have an institution_id field. | ||
|
||
import yaml | ||
import sys | ||
import glob | ||
import requests | ||
|
||
export_mapping = False | ||
|
||
# Get the list of valid institution ids | ||
response = requests.get("https://topology-institutions.osg-htc.org/api/institution_ids") | ||
topology_institutions = response.json() | ||
topology_institutions_by_id = {x['id']: x for x in topology_institutions} | ||
topology_institution_ids = {x['id'] for x in topology_institutions} | ||
|
||
def check_facility_institution_id(yaml_string: str): | ||
|
||
facility = yaml.load(yaml_string, Loader=yaml.Loader) | ||
if 'InstitutionID' not in facility: | ||
raise Exception("FACILITY.yaml does not have an InstitutionID field") | ||
|
||
if facility['InstitutionID'] not in topology_institution_ids and facility['InstitutionID'] is not None: | ||
raise Exception(f"Invalid InstitutionID: {facility['InstitutionID']}") | ||
|
||
def provide_human_check_interface(facility_files: list): | ||
|
||
facility_institution_mapping = {} | ||
for file in facility_files: | ||
with open(file, 'r') as f: | ||
facility_name = file.split('/')[-2] | ||
facility = yaml.load(f, Loader=yaml.Loader) | ||
facility_institution_mapping[facility_name] = topology_institutions_by_id.get(facility['InstitutionID'], {}).get('name', None) | ||
|
||
if export_mapping: | ||
with open("facility_institution_mapping.yaml", 'w') as f: | ||
yaml.dump(facility_institution_mapping, f) | ||
|
||
else: | ||
print(facility_institution_mapping) | ||
|
||
def main(): | ||
|
||
facility_files = glob.glob("../../../topology/**/FACILITY.yaml") | ||
|
||
# Check the files | ||
errors = [] | ||
for file in facility_files: | ||
with open(file, 'r') as f: | ||
try: | ||
check_facility_institution_id(f) | ||
except Exception as e: | ||
errors.append((file.split("/")[-2], e)) | ||
|
||
# Print the errors and exit if needed | ||
if errors: | ||
for error in errors: | ||
print(f"Error in {error[0]}: \n\t {error[1]}") | ||
sys.exit(1) | ||
|
||
provide_human_check_interface(facility_files) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
2 changes: 2 additions & 0 deletions
2
.github/scripts/check_facility_has_institution_id/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PyYAML==6.0.1 | ||
requests==2.32.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Check Project FOS Precision | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
check: | ||
name: Check | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.repository, 'opensciencegrid/') | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9.15 | ||
cache: 'pip' # caching pip dependencies | ||
- run: pip install -r ./.github/scripts/check_facility_has_institution_id/requirements.txt | ||
- run: python ./.github/scripts/check_facility_has_institution_id/main.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Department: Statistics | ||
Description: 'My research broadly focuses on (a) causal inference under interference | ||
and non-i.i.d. settings, (b) causal inference under unmeasured confounding, and | ||
(c) optimal treatment regimes and policy learning. A common theme in my research | ||
is to use non/semiparametric theory and optimization methods to develop efficient | ||
and robust estimators of causal quantities in (a)-(c). | ||
Website: https://www.chanpark.net/' | ||
FieldOfScience: Statistics | ||
FieldOfScienceID: '27.0503' | ||
InstitutionID: https://osg-htc.org/iid/10izzs5e7v1r | ||
Organization: University of Illinois Urbana-Champaign | ||
PIName: Chan Park |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Department: Computer Science | ||
Description: Studying multimodal ML applications in biomedical science. | ||
FieldOfScience: Computer Science | ||
FieldOfScienceID: '11.0701' | ||
InstitutionID: https://osg-htc.org/iid/p5mk8p3jv6wa | ||
Organization: Saint Louis University | ||
PIName: Tae-Hyuk Ahn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.