Metaflow

Latest version: v2.13

Safety actively analyzes 693883 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 23 of 28

2.4.2

The Metaflow 2.4.2 release is a patch release
- [Bug Fixes](v2.4.2_bugs)
- [Fix a bug with accessing legacy logs through `metaflow.client`](779)
- [Fix a bug with task datastore access when no task attempt has been recorded](780)

<a name="v2.4.2_bugs"></a> Bug Fixes
<a name="779"></a>Fix a bug with accessing legacy logs through `metaflow.client` (779)

2.4.1

The Metaflow 2.4.1 release is a patch release
- [Bug Fixes](v2.4.1_bugs)
- [Expose non-pythonic dependencies inside the conda environment on AWS Batch](735)
- [New Features](v2.4.1_features)
- [Introduce size properties for artifacts and logs in metaflow.client](752)
- [Expose attempt level task properties](725)
- [Introduce kubernetes decorator for launching Metaflow tasks on Kubernetes](644)

<a name="v2.4.1_bugs"></a> Bug Fixes
<a name="735"></a>Expose non-pythonic dependencies inside the conda environment on AWS Batch (735)
Prior to this release, non-pythonic dependencies in a conda environment were not automatically visible to a Metaflow task executing on AWS Batch (see 734) (they were available for tasks that were executed locally). For example
python
import os
from metaflow import FlowSpec, step, conda, conda_base, batch

class TestFlow(FlowSpec):

step
def start(self):
self.next(self.use_node)

batch
conda(libraries={"nodejs": ">=16.0.0"})
step
def use_node(self):
print(os.system("node --version"))
self.next(self.end)

step
def end(self):
pass


if __name__ == "__main__":
TestFlow()

would print an error. This release fixes the issue with the incorrect `PATH` configuration.

<a name="v2.4.1_features"></a>New Features
<a name="752"></a>Introduce size properties for artifacts and logs in metaflow.client (752)
This release exposes size properties for artifacts and logs (stderr and stdout) in metaflow.client. These properties are relied upon by the Metaflow UI ([open-sourcing soon!](https://www.eventbrite.fi/e/netflix-data-science-metaflow-gui-pre-release-meetup-tickets-185523605097)).
<a name="725"></a>Expose attempt level task properties (725)
In addition to the above mentioned properties, now users of Metaflow can access attempt specific Task metadata using the client
Python
Task('42/start/452', attempt=1)


<a name="644"></a>Introduce kubernetes decorator for launching Metaflow tasks on Kubernetes (644)
This release marks the alpha launch of `kubernetes` decorator that allows farming off Metaflow tasks onto Kubernetes. The functionality works in exactly the same manner as [`batch`](https://docs.metaflow.org/metaflow/scaling) -
python
from metaflow import FlowSpec, step, resources

class BigSum(FlowSpec):

resources(memory=60000, cpu=1)
step
def start(self):
import numpy
import time
big_matrix = numpy.random.ranf((80000, 80000))
t = time.time()
self.sum = numpy.sum(big_matrix)
self.took = time.time() - t
self.next(self.end)

step
def end(self):
print("The sum is %f." % self.sum)
print("Computing it took %dms." % (self.took * 1000))

if __name__ == '__main__':
BigSum()


python big_sum.py run --with kubernetes

will run all steps of this workflow on your existing EKS cluster (which can be configured with `metaflow configure eks`) and provides all the goodness of Metaflow!

To get started follow [this guide](https://docs.google.com/document/d/1L_4Fws1KoGg_dtSTaRlAcREX1F8FPS4ZaYk7eJyu_jA/edit)! We would appreciate your early feedback at http://slack.outerbounds.co.

2.4.0

The Metaflow 2.4.0 release is a minor release and includes a *breaking change*
- [Breaking Changes](v2.4.0_breaking)
- [Change return type of created_at/finished_at in the client](692)
- [Bug Fixes](v2.4.0_bugs)
- [Better error messages in case of a Conda issue](706)
- [Fix error message in Metadata service](690)
- [New Features](v2.4.0_features)
- [S3 retry counts are now configurable](700)
- [New datastore implementation resulting in improved performance](580)
- [S3 datatools performance improvements](697)

<a name="v2.4.0_breaking"></a>Breaking Changes
<a name="692"></a>Change return type of created_at/finished_at in the client (692)
Prior to this release, the return type for `created_at` and `finished_at` properties in the Client API was a timestamp
string. This release changes this to a `datetime` object, as the old behavior is considered an unintentional mis-feature
(see below for details).
How to retain the old behavior
To keep the old behavior, append an explicit string conversion, `.strftime('%Y-%m-%dT%H:%M:%SZ')`, to
the `created_at` and `finshed_at` calls, e.g.

run.created_at.strftime('%Y-%m-%dT%H:%M:%SZ')

Background
The first versions of Metaflow (internal to Netflix) returned a `datetime` object in all calls dealing with timestamps in
the Client API to make it easier to perform operations between timestamps. Unintentionally, the return type was changed
to string in the initial open-source release. This release introduces a number of internal changes, removing all
remaining discrepancies between the legacy version of Metaflow that was used inside Netflix and the open-source version.

The timestamp change is the only change affecting the user-facing API. While Metaflow continues to make a strong promise
of backwards compatibility of user-facing features and APIs, the benefits of one-time unification outweigh the cost of this
relatively minor breaking change.

<a name="v2.4.0_bugs"></a> Bug Fixes
<a name="706"></a>Better error messages in case of a Conda issue (706)
Conda errors printed to `stderr` were not surfaced to the user; this release addresses this issue.
<a name="690"></a>Fix error message in Metadata service (690)
The code responsible for printing error messages from the metadata service had a problem that could cause it to be unable to print the correct error message and would instead raise another error that obfuscated the initial error. This release addresses this issue and errors from the metadata service are now properly printed.
<a name="v2.4.0_features"></a>New Features
<a name="700"></a>S3 retry counts are now configurable (700)
This release allows you to set the number of times S3 access are retried (the default is 7). The relevant environment variable is: `METAFLOW_S3_RETRY_COUNT`.
<a name="580"></a>New datastore implementation resulting in improved performance (580)
The datastore implementation was reworked to make it easier to extend in the future. It also now uploads artifacts in parallel to S3 (as opposed to sequentially) which can lead to better performance. The changes also contribute to a notable improvement in the speed of `resume` which can now start resuming a flow twice as fast as before. Documentation can be found [here](https://github.com/Netflix/metaflow/blob/master/docs/datastore.md).
<a name="697"></a>S3 datatools performance improvements (697)
The S3 datatools better handles small versus large files by using the `download_file` command for larger files and using `get_object` for smaller files to minimize the number of calls made to S3.

2.3.6

The Metaflow 2.3.6 release is a patch release.
- [Bug Fixes](2.3.6_bugs)
- [Fix recursion error when `METAFLOW_DEFAULT_ENVIRONMENT` is set to `conda`](673)
- [Allow dots in `host_volumes` attribute for `batch` decorator](676)

<a name="v2.3.6_bugs"></a> Bug Fixes
[Fix recursion error when `METAFLOW_DEFAULT_ENVIRONMENT` is set to `conda`](673)
Prior to this release, setting default execution environment to `conda` through `METAFLOW_DEFAULT_ENVIRONMENT` would result in a recursion error.

METAFLOW_DEFAULT_ENVIRONMENT=conda python flow.py run


File "/Users/savin/Code/metaflow/metaflow/cli.py", line 868, in start
if e.TYPE == environment][0](ctx.obj.flow)
File "/Users/savin/Code/metaflow/metaflow/plugins/conda/conda_environment.py", line 27, in __init__
if e.TYPE == DEFAULT_ENVIRONMENT][0](self.flow)
File "/Users/savin/Code/metaflow/metaflow/plugins/conda/conda_environment.py", line 27, in __init__
if e.TYPE == DEFAULT_ENVIRONMENT][0](self.flow)
File "/Users/savin/Code/metaflow/metaflow/plugins/conda/conda_environment.py", line 27, in __init__
if e.TYPE == DEFAULT_ENVIRONMENT][0](self.flow)
[Previous line repeated 488 more times]
File "/Users/savin/Code/metaflow/metaflow/plugins/conda/conda_environment.py", line 24, in __init__
from ...plugins import ENVIRONMENTS
RecursionError: maximum recursion depth exceeded

This release fixes this bug.

[Allow dots in `host_volumes` attribute for `batch` decorator](676)
Dots in volume names - `batch(host_volumes='/path/with/.dot')` weren't being santized properly resulting in errors when a Metaflow task launched on AWS Batch. This release fixes this bug.

2.3.5

The Metaflow 2.3.5 release is a patch release.
- [Features](2.3.5_features)
- [Enable mounting host volumes in AWS Batch](441)
- [Bug Fixes](2.3.5_bugs)
- [Fix input values for Parameters of type `list` within a Metaflow Foreach task](651)

<a name="v2.3.5_features"></a> Features
[Enable mounting host volumes in AWS Batch](441)
With this release, you can now [mount and access instance host volumes](https://aws.amazon.com/premiumsupport/knowledge-center/batch-mount-efs/) within a Metaflow task running on AWS Batch. To access a host volume, you can add `host-volumes` argument to your `batch` decorator -

batch(host_volumes=['/home', '/var/log'])


<a name="v2.3.5_bugs"></a> Bug Fixes
[Fix input values for Parameters of type `list` within a Metaflow Foreach task](651)
The following flow had a bug where the value for `self.input` was being imputed to `None` rather than the dictionary element. This release fixes this issue -
python
from metaflow import FlowSpec, Parameter, step, JSONType

class ForeachFlow(FlowSpec):
numbers_param = Parameter(
"numbers_param",
type=JSONType,
default='[1,2,3]'
)

step
def start(self):
This works, and passes each number to the run_number step:

self.numbers = self.numbers_param
self.next(self.run_number, foreach='numbers')

But this doesn't:
self.next(self.run_number, foreach='numbers_param')

step
def run_number(self):
print(f"number is {self.input}")
self.next(self.join)

step
def join(self, inputs):
self.next(self.end)

step
def end(self):
pass

if __name__ == '__main__':
ForeachFlow()

2.3.4

The Metaflow 2.3.4 release is a patch release.
- [Bug Fixes](2.3.4_bugs)
- [Fix execution of `step-functions create` when using an `IncludeFile` parameter](637)

<a name="v2.3.4_bugs"></a> Bug Fixes
[Fix execution of `step-functions create` when using an `IncludeFile` parameter](637)
PR 607 in `Metaflow 2.3.3` introduced a bug with `step-functions create` command for `IncludeFile` parameters. This release rolls back that PR. A subsequent release will reintroduce a modified version of PR 607.

Page 23 of 28

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.