def runInTransaction(self, keyPathElement, toRun, waitForKeyToLoad = True):
        view = self.sharedState.newView()
        view.subscribe(self.keyRange)

        passes = 0
        while passes < 100:
            with SharedState.Transaction(view):
                key = SharedState.Key(self.keyspace, (Node.keyPathToKeyName((keyPathElement,)),))

                if not waitForKeyToLoad or view[key] is not None:
                    toRun(self, key, view)
                    return

            passes += 1
            time.sleep(.1)

        assert False, "Test timed out"
Runs a specified function in a shared state transaction.
dataset/ETHPy150Open ufora/ufora/ufora/distributed/SharedState/tests/ComputedGraphSharedState_test.py/TestComputedGraphSharedState.runInTransaction