Skip to content

Initialize thread local value on each thread#4

Open
jonson wants to merge 1 commit intomementum:masterfrom
jonson:initialize-thread-locals-per-thread
Open

Initialize thread local value on each thread#4
jonson wants to merge 1 commit intomementum:masterfrom
jonson:initialize-thread-locals-per-thread

Conversation

@jonson
Copy link
Copy Markdown

@jonson jonson commented May 2, 2020

Attributes on the thread local metadata variable were being initialized at import time by the calling thread. All access from other threads were result in errors like AttributeError: '_thread._local' object has no attribute 'minperiods''.

This change make the initialization lazy via a property and binds to the calling thread.

Copy link
Copy Markdown

@drhighliner drhighliner left a comment

Choose a reason for hiding this comment

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

Checked the code. Works like a charm!

@Haakam21
Copy link
Copy Markdown

Haakam21 commented Apr 1, 2021

I am getting the following error when calling indicators from a thread:

Unhandled Error Traceback (most recent call last): ... File "/Users/haakamaujla/Library/Python/3.8/lib/python/site-packages/pandas/core/indexers.py", line 171, in check_setitem_lengths raise ValueError( builtins.ValueError: cannot set using a slice indexer with a different length than the value

@luke82
Copy link
Copy Markdown

luke82 commented Apr 13, 2021

I test it just now and for me worked like charm too! THX

Copy link
Copy Markdown

@dangbh1002 dangbh1002 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

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

looks good, this will be handy

neilsmurphy pushed a commit to neilsmurphy/bta-lib that referenced this pull request Aug 24, 2021
neilsmurphy added a commit to neilsmurphy/bta-lib that referenced this pull request Aug 24, 2021
Changed as per Initialize thread local value on each thread mementum#4 in bta…
Copy link
Copy Markdown

@spyke555 spyke555 left a comment

Choose a reason for hiding this comment

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

Fixed the issue I was having, thanks!

@luizgomesdev
Copy link
Copy Markdown

Thanks man! U are awesome.

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.

7 participants