Skip to content

Conversation

vdusek
Copy link
Contributor

@vdusek vdusek commented Jul 11, 2024

Issues

Testing - abort last run

Sync Actor - works:

from apify_client import ApifyClient

TOKEN = '...'
ACTOR_ID = '...'


def actor_run_abort(apify_client: ApifyClient, actor_id: str) -> None:
    actor_client = apify_client.actor(actor_id)
    actor_client.call(wait_secs=1)
    last_run = actor_client.last_run(status='RUNNING', origin='API')
    aborted_info = last_run.abort()
    print(f'aborted_info: {aborted_info}')


if __name__ == '__main__':
    apify_client = ApifyClient(TOKEN)
    actor_run_abort(apify_client, ACTOR_ID)

Async Actor - works:

import asyncio
from apify_client import ApifyClientAsync

TOKEN = '...'
ACTOR_ID = '...'

async def actor_run_abort_async(apify_client: ApifyClientAsync, actor_id: str) -> None:
    actor_client = apify_client.actor(actor_id)
    await actor_client.call(wait_secs=1)
    last_run = actor_client.last_run(status='RUNNING', origin='API')
    aborted_info = await last_run.abort()
    print(f'aborted_info: {aborted_info}')

if __name__ == '__main__':
    apify_client = ApifyClientAsync(TOKEN)
    asyncio.run(actor_run_abort_async(apify_client, ACTOR_ID))

Sync task - works:

from apify_client import ApifyClient

TOKEN = '...'
TASK_ID = '...'

def task_run_abort(apify_client: ApifyClient, task_id: str) -> None:
    task_client = apify_client.task(task_id)
    task_client.call(wait_secs=1)
    last_run = task_client.last_run(status='RUNNING', origin='API')
    aborted_info = last_run.abort()
    print(f'aborted_info: {aborted_info}')

if __name__ == '__main__':
    apify_client = ApifyClient(TOKEN)
    task_run_abort(apify_client, TASK_ID)

Async task - works:

import asyncio
from apify_client import ApifyClientAsync

TOKEN = '...'
TASK_ID = '...'


async def task_run_abort_async(apify_client: ApifyClientAsync, task_id: str) -> None:
    task_client = apify_client.task(task_id)
    await task_client.call(wait_secs=1)
    last_run = task_client.last_run(status='RUNNING', origin='API')
    aborted_info = await last_run.abort()
    print(f'aborted_info: {aborted_info}')


if __name__ == '__main__':
    apify_client = ApifyClientAsync(TOKEN)
    asyncio.run(task_run_abort_async(apify_client, TASK_ID))

Testing - get storage of last run

Sync Actor - works:

from apify_client import ApifyClient

TOKEN = '...'
ACTOR_ID = '...'


def actor_run_storage(apify_client: ApifyClient, actor_id: str) -> None:
    actor_client = apify_client.actor(actor_id)
    last_run = actor_client.last_run()
    last_run_dataset_client = last_run.dataset()
    info = last_run_dataset_client.get()
    print(f'info: {info}')


if __name__ == '__main__':
    apify_client = ApifyClient(TOKEN)
    task_run_storage(apify_client, ACTOR_ID)

Async Actor - works:

import asyncio

from apify_client import ApifyClientAsync

TOKEN = '...'
ACTOR_ID = '...'


async def actor_run_storage(apify_client: ApifyClientAsync, actor_id: str) -> None:
    actor_client = apify_client.actor(actor_id)
    last_run = actor_client.last_run()
    last_run_dataset_client = last_run.dataset()
    info = await last_run_dataset_client.get()
    print(f'info: {info}')


if __name__ == '__main__':
    apify_client = ApifyClientAsync(TOKEN)
    asyncio.run(task_run_storage(apify_client, ACTOR_ID))

Sync task - works:

from apify_client import ApifyClient

TOKEN = '...'
TASK_ID = '...'


def task_run_storage(apify_client: ApifyClient, task_id: str) -> None:
    task_client = apify_client.task(task_id)
    task_client.call(wait_secs=1)
    last_run = task_client.last_run()
    last_run_dataset_client = last_run.dataset()
    info = last_run_dataset_client.get()
    print(f'info: {info}')


if __name__ == '__main__':
    apify_client = ApifyClient(TOKEN)
    task_run_storage(apify_client, TASK_ID)

Async task - works:

import asyncio

from apify_client import ApifyClientAsync

TOKEN = '...'
TASK_ID = '...'


async def task_run_storage(apify_client: ApifyClientAsync, task_id: str) -> None:
    task_client = apify_client.task(task_id)
    await task_client.call(wait_secs=1)
    last_run = task_client.last_run()
    last_run_dataset_client = last_run.dataset()
    info = await last_run_dataset_client.get()
    print(f'info: {info}')


if __name__ == '__main__':
    apify_client = ApifyClientAsync(TOKEN)
    asyncio.run(task_run_storage(apify_client, TASK_ID))

@github-actions github-actions bot added this to the 93rd sprint - Tooling team milestone Jul 11, 2024
@github-actions github-actions bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Jul 11, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Pull Request Tookit has failed!

None of the pull request and linked issue has estimate

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Pull Request Tookit has failed!

None of the pull request and linked issue has estimate

@vdusek vdusek marked this pull request as ready for review July 11, 2024 09:47
@vdusek vdusek requested review from B4nan and barjin and removed request for B4nan July 11, 2024 10:11
Copy link
Contributor

@barjin barjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm as this just reverts the known-good implementation from 1.6.4 👍🏽 cheers!

@vdusek vdusek merged commit 1aaa196 into master Jul 11, 2024
@vdusek vdusek deleted the fix-get-storage-last-run branch July 11, 2024 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t-tooling Issues with this label are in the ownership of the tooling team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1.7.0 is a breaking change Getting storages of last run does not work
2 participants