voxel51 / fiftyone

The open-source tool for building high-quality datasets and computer vision models
https://fiftyone.ai
Apache License 2.0
7.93k stars 521 forks source link

[BUG] operator set_progress error #4387

Closed yrrah closed 2 months ago

yrrah commented 2 months ago

Describe the problem

The source comments indicate that set_progress should accept a float & string... https://github.com/voxel51/fiftyone/blob/a9d02f2d3898e87a57a3c57ce1925c451cb85259/fiftyone/operators/executor.py#L726-L727

...but later attempts to access progress.progress self.log(f"Progress: {progress.progress} - {progress.label}")

Proposed fix: self.log(f"Progress: {progress} - {label}")

Code to reproduce issue

class SetProgressError(foo.Operator):
    @property
    def config(self):
        return foo.OperatorConfig(
            name="set_progress_error",
            label="Set Progress Error"
        )

    def execute(self, ctx):
        ctx.set_progress(progress=0.5,label="half way") 

System information

Other info/logs

  File "/usr/local/lib/python3.10/dist-packages/fiftyone/operators/executor.py", line 728, in set_progress
    self.log(f"Progress: {progress.progress} - {progress.label}")
AttributeError: 'float' object has no attribute 'progress'

Willingness to contribute

The FiftyOne Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the FiftyOne codebase?

brimoor commented 2 months ago

@yrrah thanks for catching this 😅

Fixed in https://github.com/voxel51/fiftyone/pull/4417 and will be released in fiftyone==0.24.0 (coming next week).