
Delete Untitled Actors
Pricing
Pay per usage
Go to Store

Delete Untitled Actors
Deletes all actors and tasks named untitled-X, my-actor-X, my-task-X from your account. In a minute. For free. With one click!
0.0 (0)
Pricing
Pay per usage
3
Total users
13
Monthly users
3
Runs succeeded
>99%
Last modified
3 years ago
Dockerfile
# This is a template for a Dockerfile used to run acts in Actor system.# The base image name below is set during the act build, based on user settings.# IMPORTANT: The base image must set a correct working directory, such as /usr/src/app or /home/userFROM apify/actor-node-basic:v0.21.10
# Second, copy just package.json and package-lock.json since it should be# the only file that affects "npm install" in the next step, to speed up the buildCOPY package*.json ./
# Install NPM packages, skip optional and development dependencies to# keep the image small. Avoid logging too much and print the dependency# tree for debuggingRUN npm --quiet set progress=false \ && npm install --only=prod --no-optional \ && echo "Installed NPM packages:" \ && (npm list --all || true) \ && echo "Node.js version:" \ && node --version \ && echo "NPM version:" \ && npm --version
# Copy source code to container# Do this in the last step, to have fast build if only the source code changedCOPY . ./
# NOTE: The CMD is already defined by the base image.# Uncomment this for local node inspector debugging:# CMD [ "node", "--inspect=0.0.0.0:9229", "main.js" ]
main.js
1const Apify = require('apify');2const request = require('request-promise');3
4Apify.main(async () => {5 console.log('Removing actors ...');6
7 const actors = await Apify.client.acts.listActs();8 const untitledActors = actors9 .items10 .filter(act => act.name.startsWith('untitled') || act.name.startsWith('my-actor'));11 12 for (let act of untitledActors) {13 console.log(`Deleting act ${act.name}`);14 await Apify.client.acts.deleteAct({ actId: act.id }).catch((actId) => `Error: Could not remove actor ${actId}!`);15 }16
17 console.log('Removing tasks ...');18
19 const tasks = await Apify.client.tasks.listTasks();20 const untitledTasks = tasks21 .items22 .filter(task => task.name.startsWith('untitled') || task.name.startsWith('my-task'));23 24 for (let task of untitledTasks) {25 console.log(`Deleting task ${task.name}`);26 await Apify.client.tasks.deleteTask({ taskId: task.id }).catch((taskId) => `Error: Could not remove task ${taskId}!`);27 }28
29 console.log('Done');30});
package.json
{ "name": "apify-project", "version": "0.0.1", "description": "", "author": "It's not you it's me", "license": "ISC", "dependencies": { "apify": "0.21.10", "request-promise": "latest" }, "scripts": { "start": "node main.js" }}