Title: Unexpected(?) behaviour in `Graph.apply` · Issue #43 · spotify/pythonflow · GitHub
Open Graph Title: Unexpected(?) behaviour in `Graph.apply` · Issue #43 · spotify/pythonflow
X Title: Unexpected(?) behaviour in `Graph.apply` · Issue #43 · spotify/pythonflow
Description: I ran into an issue today while attempting repeated evaluations of a graph. My rough usage pattern looks like this: context = {'a': 1, 'b': 2} for df in frames: out = graph(outputs, context=context, frame=df) Which worked fine for the fi...
Open Graph Description: I ran into an issue today while attempting repeated evaluations of a graph. My rough usage pattern looks like this: context = {'a': 1, 'b': 2} for df in frames: out = graph(outputs, context=context...
X Description: I ran into an issue today while attempting repeated evaluations of a graph. My rough usage pattern looks like this: context = {'a': 1, 'b': 2} for df in frames: out = graph(outputs,...
Opengraph URL: https://github.com/spotify/pythonflow/issues/43
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unexpected(?) behaviour in `Graph.apply`","articleBody":"I ran into an issue today while attempting repeated evaluations of a graph. My rough usage pattern looks like this:\r\n\r\n```python\r\ncontext = {'a': 1, 'b': 2}\r\nfor df in frames:\r\n\tout = graph(outputs, context=context, frame=df)\r\n```\r\n\r\nWhich worked fine for the first call but fails with the following error on the second call:\r\n\r\n```python\r\nValueError: duplicate value for operation '\u003cpf.placeholder 'first_input'\u003e'\r\n```\r\n\r\nAfter some digging, I noticed that the `Graph.normalize_context` method modifies the `context` in-place. It is not mentioned in the documentation, and given the semantics of a `Graph.apply` this does not seem like an expected (or desired?) side-effect.\r\n\r\nIs this something that should be updated in the documentation? Should `Graph.normalize_context` be modified to copy the context and not modify it in-place? Or is there a better pattern I should be using if I need to repeatedly call the graph object with some constant context and a handful of varying placeholders? (It probably wouldn't hurt to update the documentation with that pattern if there is one).","author":{"url":"https://github.com/easyas314159","@type":"Person","name":"easyas314159"},"datePublished":"2019-10-18T08:03:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/43/pythonflow/issues/43"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d66f9624-c9e6-a706-3c9d-edf436a1a5ba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8CA6:123F55:1FE06D:2C2826:6A513332 |
| html-safe-nonce | 315a5cb8f98dd75261e5876bfc1efe1f98a5820c9a69e34ad71da7ecde73b3c0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Q0E2OjEyM0Y1NToxRkUwNkQ6MkMyODI2OjZBNTEzMzMyIiwidmlzaXRvcl9pZCI6IjY2ODM3ODE2MTQ3OTc5MjcyMTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8d656362fb0ee185c8e6359a63441cf33cefda768722a58f190c7ee6ae1aef01 |
| hovercard-subject-tag | issue:508920223 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/spotify/pythonflow/43/issue_layout |
| twitter:image | https://opengraph.githubassets.com/557a687073ac767e256053c208c14a5960156658a6c6aee353f8dedf18199beb/spotify/pythonflow/issues/43 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/557a687073ac767e256053c208c14a5960156658a6c6aee353f8dedf18199beb/spotify/pythonflow/issues/43 |
| og:image:alt | I ran into an issue today while attempting repeated evaluations of a graph. My rough usage pattern looks like this: context = {'a': 1, 'b': 2} for df in frames: out = graph(outputs, context=context... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | easyas314159 |
| hostname | github.com |
| expected-hostname | github.com |
| None | e840f405b2718e8f2d55aafa9ff27dbce17e29d0c253011d05ea0fea3c78baff |
| turbo-cache-control | no-preview |
| go-import | github.com/spotify/pythonflow git https://github.com/spotify/pythonflow.git |
| octolytics-dimension-user_id | 251374 |
| octolytics-dimension-user_login | spotify |
| octolytics-dimension-repository_id | 102513092 |
| octolytics-dimension-repository_nwo | spotify/pythonflow |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 102513092 |
| octolytics-dimension-repository_network_root_nwo | spotify/pythonflow |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4ae6027e8ba70c79dc08249bb6cdc1a09d788496 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width