Skip to content

etelemetry pollutes stdout by default #3053

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

Closed
effigies opened this issue Sep 26, 2019 · 5 comments
Closed

etelemetry pollutes stdout by default #3053

effigies opened this issue Sep 26, 2019 · 5 comments
Milestone

Comments

@effigies
Copy link
Member

Summary

It would be nice to be able to import nipype without having to decide between disabling etelemetry and triggering output to stdout.

> fitlins --version
190925-23:25:59,835 nipype.utils WARNING:
	 Could not check for version updates: 
Connection to server could not be made
190925-23:25:59,836 nipype.utils INFO:
	 Running nipype version 1.2.3 (latest: Unknown)
fitlins v0.5.1+6.g4606e4f

I can go ahead and work to delay imports so that running --help or --version never hits import nipype, but that seems a bit much to ask of most tools.

Perhaps we could make it trigger on something like on the first instantiation of a workflow or interface, instead of import?

Execution environment

  • circleci/python:latest
@satra
Copy link
Member

satra commented Sep 26, 2019

@effigies - i agree - this is something i was trying to help with by encapsulating the etelemetry into a check in #3049

so we can definitely move the check as a one time check in either EngineBase or BaseInterface, or perhaps just BaseInterface, since that will be used for any workflow node. but i think importing nipype also imports function, which would then trigger this baseinterface check.

the alternative is to make this happen with the first run call on an interface or workflow. that may be a better situation.

@effigies
Copy link
Member Author

I think you can do it in EngineBase.__init__ without triggering on import. I just added a print statement:

>>> import nipype
>>> _ = nipype.pipeline.engine.base.EngineBase(name="test")                                                                           
Initialized

What if we decorate check_version with @functools.lru_cache so we don't need to maintain a global state? Then we can just update EngineBase.__init__ with very simple logic:

class EngineBase(object):
    """Defines common attributes and functions for workflows and nodes."""

    def __init__(self, name=None, base_dir=None):
        """ Initialize base parameters of a workflow or node

        Parameters
        ----------
        name : string (mandatory)
            Name of this node. Name must be alphanumeric and not contain any
            special characters (e.g., '.', '@').
        base_dir : string
            base output directory (will be hashed before creations)
            default=None, which results in the use of mkdtemp

        """
        self._hierarchy = None
        self.name = name
        self._id = self.name # for compatibility with node expansion using iterables

        self.base_dir = base_dir
        self.config = deepcopy(config._sections)
        if self.config.getboolean('execution', 'check_version'):
            check_version()

@oesteban
Copy link
Contributor

I was about to report this. Thanks!

@effigies
Copy link
Member Author

Proposed satra#30. Not sure where we want to continue this discussion, so now all three threads are linked.

@effigies effigies added this to the 1.3.0 milestone Oct 8, 2019
@effigies
Copy link
Member Author

effigies commented Oct 8, 2019

Fixed in #3049

@effigies effigies closed this as completed Oct 8, 2019
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

No branches or pull requests

3 participants