From 30a688cb92333d52de13f075b0c97e7f312d9ff9 Mon Sep 17 00:00:00 2001 From: Julia Schumann Date: Wed, 25 Sep 2024 10:06:58 +0200 Subject: [PATCH] fix pubchem call and include random sleep before pubchem call --- src/nomad_catalysis/schema_packages/catalysis.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/nomad_catalysis/schema_packages/catalysis.py b/src/nomad_catalysis/schema_packages/catalysis.py index f81db71..96f87d8 100644 --- a/src/nomad_catalysis/schema_packages/catalysis.py +++ b/src/nomad_catalysis/schema_packages/catalysis.py @@ -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') @@ -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: