Skip to content

Connecting to All Known Data Archive and Asset Framework Servers on Import #722

@zslp2

Description

@zslp2

Bug report

Description

On import of PIconnect.PIServer, _lookup_servers() in PIconnect/PI.py and PIconnect/PIAF.py iterate over and connect to each known Data Archive (DA) and Asset Framework (AF) Server respectively. I have +70 known DA servers (most geographically remote, many over a slow data link) and ~50 known AF servers (again most geographically remote, many over a slow data link). This causes package import to take several minutes.

To Reproduce

Steps to reproduce the behavior:

from PIconnect import PIServer

Expected behavior

Package loads without iterating over and connecting to each DA and AF server.

Possible solutions

I am not sure if PIconnect is iterating over and connecting to each DA and AF server for any specific reasons other than to (1) make the connection and (2) list the known databases for each AF server. Even making an automatic connection to the default DA and AF server in _lookup_default_server() is potentially unwanted overhead, since I am always connecting to a specific system through PIServer() or PIAFDatabase().

Since the behavior happens at import, I think the only way to control that behavior is through an environment variable to bypass calls to _lookup_servers() and _lookup_default_server(); however this is only a guess.

System

  • OS: [Windows]
  • Python version: [Python 3.11]
  • PIconnect version: [e.g. 0.10.6]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions