Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'str' object has no attribute 'awrite_path' #16486

Closed
tonal opened this issue Dec 24, 2024 · 5 comments · Fixed by #16498
Closed

AttributeError: 'str' object has no attribute 'awrite_path' #16486

tonal opened this issue Dec 24, 2024 · 5 comments · Fixed by #16498
Assignees
Labels
bug Something isn't working

Comments

@tonal
Copy link

tonal commented Dec 24, 2024

Bug summary

An error was encountered while committing transaction 'f67b09781f293d2c4071ad3bdb6acf79'
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/prefect/transactions.py", line 323, in commit
    self.store.persist_result_record(
  File "/usr/local/lib/python3.12/site-packages/prefect/results.py", line 751, in persist_result_record
    return self._persist_result_record(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/utilities/asyncutils.py", line 349, in coroutine_wrapper
    return run_coro_as_sync(ctx_call())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/utilities/asyncutils.py", line 199, in run_coro_as_sync
    result = from_sync.call_in_new_thread(coroutine_wrapper)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/_internal/concurrency/api.py", line 220, in call_in_new_thread
    return call.result()
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 330, in result
    return self.future.result(timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 193, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 403, in _run_async
    result = await coro
             ^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/utilities/asyncutils.py", line 190, in coroutine_wrapper
    return await task
           ^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/utilities/asyncutils.py", line 343, in ctx_call
    result = await async_fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/results.py", line 731, in _persist_result_record
    await _call_explicitly_async_block_method(
  File "/usr/local/lib/python3.12/site-packages/prefect/results.py", line 248, in _call_explicitly_async_block_method
    return await getattr(block.__class__.__name__, f"a{method}")(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'awrite_path'

Version info

$ prefect version
14:53:09.604 | DEBUG   | prefect.profiles - Using profile 'local'
Version:             3.1.9
API version:         0.8.4
Python version:      3.12.8
Git commit:          e1fe7943
Built:               Fri, Dec 20, 2024 4:33 PM
OS/Arch:             linux/x86_64
Profile:             local
Server type:         ephemeral
Pydantic version:    2.10.4
Server:
  Database:          sqlite
  SQLite version:    3.45.1
Integrations:
  prefect-aws:       0.5.3


### Additional context

_No response_
@tonal tonal added the bug Something isn't working label Dec 24, 2024
@zzstoatzz
Copy link
Collaborator

hi @tonal - thanks for the report!

this seems related to #16445

do you have any information as far as reproduction? what kind of result storage block are you using?

@tonal
Copy link
Author

tonal commented Dec 25, 2024

do you have any information as far as reproduction?

A see crash code:

    if hasattr(block, f"a{method}"):  # explicit async method
        return await getattr(block.__class__.__name__, f"a{method}")(*args, **kwargs)

block.__class__.__name__ - it is string.
Maybe there should be a code like this:

    if hasattr(block, f"a{method}"):  # explicit async method
        return await getattr(block, f"a{method}")(*args, **kwargs)

@zzstoatzz
Copy link
Collaborator

oof @tonal you are totally right - I'll get a PR up for that and we'll get that released as soon as possible! sorry about that

@zzstoatzz
Copy link
Collaborator

@tonal this should be fixed in #16498, if you have a chance to verify that this fixes your case, it would be very appreciated!

pip install git+https://github.com/prefecthq/prefect.git@fix-16486

thanks again for the report!

@zzstoatzz zzstoatzz self-assigned this Dec 25, 2024
@tonal
Copy link
Author

tonal commented Dec 25, 2024

@tonal this should be fixed in #16498, if you have a chance to verify that this fixes your case, it would be very appreciated!

Yes! All worked! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants