IN-CORE / pyincore

pyIncore is a component of IN-CORE. It is a python package consisting of two primary components: 1) a set of service classes to interact with the IN-CORE web services, and 2) IN-CORE analyses . The pyIncore allows users to apply various hazards to infrastructure in selected areas, propagating the effect of physical infrastructure damage and loss of functionality to social and economic impacts.
Mozilla Public License 2.0
25 stars 7 forks source link

455 update get allowed demands method to return fixed information if offline #456

Closed longshuicy closed 11 months ago

longshuicy commented 11 months ago

This PR:

To test:

ylyangtw commented 11 months ago

image Hmm no item is collected... Did I test it correctly? I am using this command python -m pytest tests/pyincore/analyses/buildingdamage/test_buildingdamage_offline.py

longshuicy commented 11 months ago

image Hmm no item is collected... Did I test it correctly? I am using this command python -m pytest tests/pyincore/analyses/buildingdamage/test_buildingdamage_offline.py

Ah all the test against analyses are not "pytest". you might just want to run them as a normal python script.

navarroc commented 11 months ago

Not for this PR, but I wonder if we need to check for offline mode so someone doesn't try to use an offline client to do operations like create an EQ.

longshuicy commented 11 months ago

Not for this PR, but I wonder if we need to check for offline mode so someone doesn't try to use an offline client to do operations like create an EQ.

Good catch. I will create a task.

ywkim312 commented 11 months ago

What is the meaning of "Add allowed demand information to pyglobals" in the main description? I mean what is working with pyglobals. Also, the only hazardservice uses the offline, because this PR is only for "get allowed demands" method?

longshuicy commented 11 months ago

What is the meaning of "Add allowed demand information to pyglobals" in the main description? I mean what is working with pyglobals. Also, the only hazardservice uses the offline, because this PR is only for "get allowed demands" method?

navarroc commented 11 months ago

What is the meaning of "Add allowed demand information to pyglobals" in the main description? I mean what is working with pyglobals. Also, the only hazardservice uses the offline, because this PR is only for "get allowed demands" method?

The name is what was originally planned (putting the demand types in globals), but after discussion, it seemed better closer to the hazard service since it impacted the hazard service.

It was discovered that when running with local data, the hazard service still needed to talked to the service to get the allowed demand types. But if a user is offline, that is not available. This adds them to pyincore so they are available for offline mode so now a user should be able to run pyincore entirely offline.