Skip to content

Commit

Permalink
fix pubchem call and include random sleep before pubchem call
Browse files Browse the repository at this point in the history
  • Loading branch information
schumannj committed Sep 25, 2024
1 parent ca77b3c commit 30a688c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/nomad_catalysis/schema_packages/catalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,8 @@ def update_chemical_info(self):
chemical_key = chemical_data[chemical_key]

pure_component = PubChemPureSubstanceSection()
pure_component.name = self.name
if chemical_key:
pure_component.name = self.name
pure_component.pub_chem_id = chemical_key.get('pub_chem_id')
pure_component.iupac_name = chemical_key.get('iupac_name')
pure_component.molecular_formula = chemical_key.get('molecular_formula')
Expand Down Expand Up @@ -723,11 +723,13 @@ def normalize(self, archive, logger):
self.pure_component = pure_component

if self.pure_component.iupac_name is not None:
logger.info(f'found {self.name} in chemical_data, no pubchem call made')
return
else:
import random
import time

time.sleep(1)
time.sleep(random.uniform(0.5, 5))
self.pure_component.normalize(archive, logger)

if self.name is None and self.pure_component is not None:
Expand Down

0 comments on commit 30a688c

Please sign in to comment.