Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternate way of fetching resources #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andreavs
Copy link

@andreavs andreavs commented Dec 11, 2020

with this pr it takes 2-3 secs to run client.substations.list().shunt_compensators(), but 1 minute to run client.substations.list().busbar_sections()

labels=LabelFilter(contains_all=[label]),
limit=None,
assets = self._cognite_client.power_assets.list(
grid_type=grid_type, base_voltage=base_voltage, **{"metadata": {"type": power_type}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

**{"x":"y"} is commonly also known as x="y"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note power_type may be None

labels=LabelFilter(contains_all=[label]),
limit=None,
)
assets = [a for a in assets if a.external_id in [r.target_external_id for r in rels]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target_external_ids = {r.target_external_id for r in rels}
and then in (set) here please

labels=LabelFilter(contains_all=[label]),
limit=None,
)
assets = [a for a in assets if a.external_id in [r.source_external_id for r in rels]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likewise

Copy link
Contributor

@sanderland sanderland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:50:

@@ -1,5 +1,4 @@
import sys
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import sys
import grouphug

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants