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

Move etelemetry logic to become in effect also when used as a Python library #726

Closed
yarikoptic opened this issue Jul 22, 2021 · 3 comments · Fixed by #728
Closed

Move etelemetry logic to become in effect also when used as a Python library #726

yarikoptic opened this issue Jul 22, 2021 · 3 comments · Fixed by #728
Assignees

Comments

@yarikoptic
Copy link
Member

ATM we have etelemetry under cli/command.py:main so it is only in effect for CLI. As we will use it now to prevent "bad" versions (#725), we should make it used consistently between CLI and when used as a Python module.

Not yet sure how to not bother with etelemetry if user does use CLI but merely for --help -- I guess it is ok to do all etelemetry checks/etc, but if we are to fail on bad version, we should not bother with etelemetry for "every import".

Since the main rationale is for "interactions with dandiarchive" I think we should

  • make etelemetry check helper a "run once" (so even if invoked multiple times - checks only once)
  • keep it at CLI level where it is
  • add to top level DandiAPIClient.__init__

@satra - do you foresee any other aspects I forgot, or locations where to do the check? e.g. organize in principle also a worthy location to perform the check, but since used most likely through CLI -- should be covered.

@satra
Copy link
Member

satra commented Jul 22, 2021

i think CLI is our main use case at the moment, more than library, so i think it should happen in the CLI, but possibly for any command (including ls and organize, which could be affected by schema versions).

once the library is actually released, we can check how to inform user then. in other projects we tend to call it once in init and never gets called again. but is called each time for a python process (but we pass on NO_ET to subprocesses).

@yarikoptic
Copy link
Member Author

we are using it as a library already in many ad-hoc scripts, and who knows what users do on the hub etc. library was released from day 1 of the CLI release if not before, we just do not promote it too heavily I guess ;)

NO_ET -- hm, we probably should not "alter" behavior for "other libraries", so may be as part of the fix for this issue, @jwodder we should introduce DANDI_NO_ET and

  • if present - do not do the test
  • after test is done, assign it in sys.environ

again -- who knows how users would use the beast. WDYT @satra ?

@satra
Copy link
Member

satra commented Jul 22, 2021

sounds good and indeed dandi should use DANDI_NO_ET

yarikoptic added a commit that referenced this issue Jul 22, 2021
Invoke etelemetry when constructing a DandiAPIClient; honor DANDI_NO_ET
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 a pull request may close this issue.

3 participants