BlueBrain / nexus-forge

Building and Using Knowledge Graphs made easy
https://nexus-forge.readthedocs.io
GNU Lesser General Public License v3.0
38 stars 19 forks source link

Forge does not initialize on OpenShift pods with no access to internet (external network) #178

Closed eugeniashurko closed 2 years ago

eugeniashurko commented 3 years ago

Initializing forge inside an OpenShift pod with no access to the external network fails with the following error:

  File "/usr/local/lib/python3.7/site-packages/kgforge/specializations/stores/nexus/service.py", line 167, in resolve_context
    raise ValueError(f"{iri} is not resolvable")
ValueError:  https://bluebrainnexus.io/contexts/metadata.json is not resolvable

Sometimes this error appears after a very long delay, when I think forge tries to connect to some external URL and waits for a response.

Here are some details on init and config:

In my app, I run forge = KnowledgeGraphForge(config, token=TOKEN), where config points to the file with the following content:

Model:
  name: RdfModel
  origin: store
  source: BlueBrainNexus
  context:
    iri: "https://bbp.neuroshapes.org"
    bucket: "neurosciencegraph/datamodels"

Store:
  name: BlueBrainNexus
  endpoint: https://bbp.epfl.ch/nexus/v1
  bucket: <MY_BUCKET>
  searchendpoints:
    sparql:
      endpoint: "https://bluebrain.github.io/nexus/vocabulary/defaultSparqlIndex"
  vocabulary:
    iri: "https://bluebrainnexus.io/contexts/metadata.json"
    namespace: "https://bluebrain.github.io/nexus/vocabulary/"
    deprecated_property: "https://bluebrain.github.io/nexus/vocabulary/deprecated"
    project_property: "https://bluebrain.github.io/nexus/vocabulary/project"
  max_connection: 50
  versioned_id_template: "{x.id}?rev={x._store_metadata._rev}"
  file_resource_mapping: ./file-to-resource

Resolvers:
  ontology:
    - resolver: OntologyResolver
      origin: store
      source: BlueBrainNexus
      targets:
        - identifier: terms
          bucket: neurosciencegraph/datamodels
      result_resource_mapping: https://raw.githubusercontent.com/BlueBrain/nexus-forge/master/examples/configurations/nexus-resolver/term-to-resource-mapping.hjson
  agent:
    - resolver: AgentResolver
      origin: store
      source: BlueBrainNexus
      targets:
        - identifier: agents
          bucket: bbp/agents
      result_resource_mapping: https://raw.githubusercontent.com/BlueBrain/nexus-forge/master/examples/configurations/nexus-resolver/agent-to-resource-mapping.hjson

Formatters:
  identifier: https://bbp.epfl.ch/neurosciencegraph/data/{}/{}