Skip to content

Commit

Permalink
Fix info endpoint, and update dockerfiles (#1461)
Browse files Browse the repository at this point in the history
  • Loading branch information
DhanshreeA committed Dec 17, 2024
1 parent 41e1e7e commit 143ebdf
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/scripts/airtableops.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def items_all(self):

class AirtableMetadata(AirtableInterface):
def __init__(self, model_id, api_key=None, mode="ro"):
super().__init__(mode=mode, api_key=api_key)
self.model_id = model_id
super().__init__(self, mode=mode, api_key=api_key)
self._empty_row_message = "The AirTable field Identifier was not found! Please check that there are not empty rows."

def _find_record(self):
Expand Down Expand Up @@ -96,7 +96,7 @@ def _find_airtable_record_id(self):

def read_information(self):
data = self._find_record()
bi = BaseInformation(config_json=self.config_json)
bi = BaseInformation()
bi.from_dict(data)
return bi

Expand Down Expand Up @@ -266,7 +266,7 @@ def update_metadata_to_airtable(user, repo, branch, api_key):
# Works with airtable-update option
rm = RepoMetadataFile(model_id=repo, config_json=None)
data = rm.read_information(org=user, branch=branch)
am = AirtableMetadata(model_id=repo, config_json=None)
am = AirtableMetadata(model_id=repo, api_key=api_key, mode="rw")
am.write_information(data)


Expand Down
7 changes: 5 additions & 2 deletions dockerfiles/dockerize-ersiliapack/model/Dockerfile.conda
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ ARG MODEL=eos_identifier
ENV MODEL=$MODEL
WORKDIR /root
COPY ./$MODEL /root/$MODEL
RUN mkdir /root/bundles && ersilia_model_pack --repo_path $MODEL --bundles_repo_path /root/bundles
RUN apt-get update && \
apt-get install -y git && \
mkdir /root/bundles && ersilia_model_pack --repo_path $MODEL --bundles_repo_path /root/bundles && \
apt-get remove --purge -y git && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN conda create --name baseclone --clone base
RUN conda install -c conda-forge conda-pack
RUN conda-pack -n baseclone -o /tmp/env.tar && \
Expand All @@ -28,7 +31,7 @@ ENV PATH="/usr/bin/conda/bin/:$PATH"
COPY --from=build /root/bundles /root/bundles
COPY --from=build /root/docker-entrypoint.sh /root/docker-entrypoint.sh
COPY --from=build /venv /usr/bin/conda

RUN conda install -c conda-forge xorg-libxrender xorg-libxtst
RUN cp /root/bundles/$MODEL/*/information.json /root/information.json && \
cp /root/bundles/$MODEL/*/api_schema.json /root/api_schema.json && \
cp /root/bundles/$MODEL/*/status.json /root/status.json && \
Expand Down
10 changes: 9 additions & 1 deletion dockerfiles/dockerize-ersiliapack/model/Dockerfile.pip
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ ARG MODEL=eos_identifier
ENV MODEL=$MODEL
WORKDIR /root
COPY ./$MODEL /root/$MODEL
RUN mkdir /root/bundles && ersilia_model_pack --repo_path $MODEL --bundles_repo_path /root/bundles && \

RUN apt-get update && apt-cache search libxtst && \
apt-get install -y libfontconfig1 libxrender1 libxtst6 && \
apt-get clean && rm -rf /var/lib/apt/lists/*

RUN apt-get update && \
apt-get install -y git && \
mkdir /root/bundles && ersilia_model_pack --repo_path $MODEL --bundles_repo_path /root/bundles && \
apt-get remove --purge -y git && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* && \
rm -rf /root/$MODEL && rm -rf /root/.cache && \
cp /root/bundles/$MODEL/*/information.json /root/information.json && \
cp /root/bundles/$MODEL/*/api_schema.json /root/api_schema.json && \
Expand Down
4 changes: 4 additions & 0 deletions ersilia/serve/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,10 @@ def _get_apis(self):
self.logger.debug("Status code: {0}".format(response.status_code))
if response.status_code == 502:
raise BadGatewayError(url)
elif response.status_code == 405: # We try the GET endpoint here
response = requests.get(url)
else:
response.raise_for_status()
apis_list = json.loads(response.text)["apis_list"]
self.logger.debug("Writing file {0}".format(file_name))
with open(file_name, "w") as f:
Expand Down

0 comments on commit 143ebdf

Please sign in to comment.