You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Kenneth Knowles (Jira)" <ji...@apache.org> on 2022/01/12 03:50:04 UTC
[jira] [Updated] (BEAM-13603) Shared object does not read from cache when using tag
[ https://issues.apache.org/jira/browse/BEAM-13603?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kenneth Knowles updated BEAM-13603:
-----------------------------------
This Jira ticket has a pull request attached to it, but is still open. Did the pull request resolve the issue? If so, could you please mark it resolved? This will help the project have a clear view of its open issues.
> Shared object does not read from cache when using tag
> -----------------------------------------------------
>
> Key: BEAM-13603
> URL: https://issues.apache.org/jira/browse/BEAM-13603
> Project: Beam
> Issue Type: Bug
> Components: sdk-py-core
> Reporter: ELVIS WIANDA
> Priority: P1
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> {code:java}
> cat shared_test.py{code}
>
> {code:java}
> import unittest
> from apache_beam.utils import shared
> class NamedObject(object):
> def __init__(self, name):
> self._name = name
> def get_name(self):
> return self._name
> class Sequence(object):
> def __init__(self):
> self._sequence = 0
> def make_acquire_fn(self):
> # Every time acquire_fn is called, increases the sequence number and returns
> # a NamedObject with that sequenece number.
> def acquire_fn():
> self._sequence += 1
> return NamedObject("sequence%d" % self._sequence)
> return acquire_fn
> class SharedTest(unittest.TestCase):
> def testDifferentObjects(self):
> sequence = Sequence()
> handle = shared.Shared()
> f1 = handle.acquire(sequence.make_acquire_fn(), tag="1")
> self.assertEqual("sequence1", f1.get_name())
> # should pass
> f1 = handle.acquire(sequence.make_acquire_fn(), tag="1")
> self.assertEqual("sequence1", f1.get_name())
> if __name__ == "__main__":
> unittest.main()
> {code}
> {code:java}
> python shared_test.py {code}
> {code:java}
> F
> ======================================================================
> FAIL: testDifferentObjects (__main__.SharedTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "shared_test.py", line 59, in testDifferentObjects
> self.assertEqual("sequence1", f1.get_name())
> AssertionError: 'sequence1' != 'sequence2'
> - sequence1
> ? ^
> + sequence2
> ? ^
>
> {code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)