You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
N.B In the process of creating the minimal reproduction I have managed to resolve my immediate issue but I do think there is a problem here that others may face.
Fix/workaround : Stopping element objects being returned by casting to str and int where appropriate:
This Prefect flow extracts file lists from a Google Cloud Storage (GCS) bucket and then processes them in batches. Each batch downloads XML files from GCS and then uses lxml to extract specific fields using XPath. Memory usage when executing as Prefect flow without the @task decorator is stable but with the decorator each iteration of the loop sees memory increase until all memory is exhausted.
This shows memory usage across 4 runs. (ignore line at 6Gb which is the memory limit)
@task decorator added to original code. Peaks over 2GB
@task decorator removed. Stable at 400Mb
@task decorator added. Code changed to cast xml element used in return. Stable at 300Mb
Code reverted and @task decorator added
Output from objgraph for one random element object (as profiling showed a steady increase in element objects over time)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Prefect Slack Discussion
N.B In the process of creating the minimal reproduction I have managed to resolve my immediate issue but I do think there is a problem here that others may face.
Fix/workaround : Stopping element objects being returned by casting to str and int where appropriate:
This Prefect flow extracts file lists from a Google Cloud Storage (GCS) bucket and then processes them in batches. Each batch downloads XML files from GCS and then uses lxml to extract specific fields using XPath. Memory usage when executing as Prefect flow without the
@task
decorator is stable but with the decorator each iteration of the loop sees memory increase until all memory is exhausted.This shows memory usage across 4 runs. (ignore line at 6Gb which is the memory limit)
@task
decorator added to original code. Peaks over 2GB@task
decorator removed. Stable at 400Mb@task
decorator added. Code changed to cast xml element used in return. Stable at 300Mb@task
decorator addedOutput from objgraph for one random element object (as profiling showed a steady increase in element objects over time)
Full project available here:
https://gitlab.com/vee-engineering-public/issues/prefect-xml-memory
Beta Was this translation helpful? Give feedback.
All reactions