Tasks & storage
Understand how to save the configurations for Actors with Actor tasks. Also, learn about storage and the different types Apify offers.
Both of these are very different things; however, they are also tied together in many ways. Tasks run Actors, Actors return data, and data is stored in different types of Storages.
Tasks
Tasks are a very useful feature which allow us to save pre-configured inputs for Actors. This means that rather than configuring the Actor every time, or rather than having to save screenshots of various different Actor configurations, you can store the configurations right in your Apify account instead, and run the Actor at will with them.
Storage
Storage allows us to save persistent data for further processing. As you'll learn, there are two main storage options on the Apify platform, as well as two main storage types (named and unnamed) with one big difference between them.
Learning 🧠
- Check out the docs about Actor tasks.
- Read about the two main storage options on the Apify platform.
- Understand the crucial differences between named and unnamed storages.
- Learn about the
Dataset
andKeyValueStore
objects in the Apify SDK.
Knowledge check 📝
- What is the relationship between Actors and tasks?
- What are the differences between default (unnamed) and named storage? Which one would you use for everyday usage?
- What is data retention, and how does it work for all types of storages (default and named)?
Our task
Once again, we'll be adding onto our main Amazon-scraping Actor in this activity, but don't worry - this lesson will be quite light, just like the last one.
We have decided that we want to retain the data scraped by the Actor for a long period of time, so instead of pushing to the default dataset, we will be pushing to a named dataset. Additionally, we want to save the absolute cheapest item found by the scraper into the default key-value store under a key named CHEAPEST-ITEM.
Finally, we'll create a task for the Actor that saves the configuration with the keyword set to google pixel.
Next up
The next lesson is very exciting, as it will unlock the ability to seamlessly integrate your Apify Actors into your own external projects and applications with the Apify API.