![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
djorm-cloud-jobs
Advanced tools
Tiny library that helps you run huge workloads as small distributed jobs in cloud environment
djorm-cloud-jobs
Tiny library that helps you run huge workloads as small distributed jobs in cloud environment.
For the moment, only Google Cloud Platform is supported.
npm install djorm-cloud-jobs
Add djorm-cloud-jobs/config
to apps
djorm config.
const { configure } = require('djorm/config')
configure({
apps: [
'djorm-cloud-jobs/config'
],
jobs: {
model: 'djorm-cloud-jobs.Job',
local: process.env.NODE_ENV === 'local'
}
})
jobs.model
(string, default 'gcpi-models-jobs.Job'
) name of the model used to store jobs. You can either use the Job
model or extend the abstract JobBase
model.
jobs.local
(boolean, default false
) run the jobs locally (don't use that in production)
The jobs are expected to be run in Cloud Function environment. So first, you need to create an entrypoint.
const { createSubscription } = require('djorm-cloud-jobs')
module.exports = createSubscription({
filename: __filename,
topic: 'job-topic',
tasks: job => {
// process job.props
}
})
The processing stores updates job status based on the outcome of the processing function.
You can specify that the entrypoint will process multiple different types of Jobs. Good examples are scrapers, so let's scrape some pets API.
const { createSubscription } = require('djorm-cloud-jobs')
const ScrapeTriggers = {
ownerList: 'load:owner:all',
ownerDetail: 'load:owner:detail',
ownerPetList: 'load:owner:pet:all'
}
module.exports = createSubscription({
filename: __filename,
topic: 'job-topic',
tasks: {
[ScrapeTriggers.ownerList]: job => {
// Fetch owner list and trigger details fetch for each owner
await Promise.all(ownerList.map(owner =>
job.spawnChild({
props: {
owner
}
})
)
},
[ScrapeTriggers.ownerDetail]: job => {
const { owner } = job.props
// Fetch owner details for a specific owner
// Store owner details
// Trigger pets details fetch for each pet
await Promise.all(owner.pets.map(pet =>
job.spawnChild({
props: {
owner,
pet
}
})
)
},
[ScrapeTriggers.ownerPetList]: job => {
const { owner, pet } = job.props
// Now fetch and store the owner's pet's details
}
}
})
To make the jobs interact with each other, you can define hooks. Let's consider ScrapeTriggers
from previous example. We want to trigger another job when the ScrapeTriggers.ownerList
job ends successfully. Please note that it is considered successful only if all the descendants finish with success status.
const { createSubscription } = require('djorm-cloud-jobs')
const LocationTriggers = {
petLocationHistory: 'load:pet:location-history'
}
module.exports = createSubscription({
filename: __filename,
topic: 'job-topic',
tasks: {
[ScrapeTriggers.ownerList]: {
onRequest: job => {
// Same as above
},
onSuccess: job => {
job.constructor.debounce({
type: LocationTriggers.fetchPetLocationHistory,
})
}
}
}
})
runJob
0.2.0-alpha.0 (2023-06-09)
FAQs
Tiny library that helps you run huge workloads as small distributed jobs in cloud environment
The npm package djorm-cloud-jobs receives a total of 0 weekly downloads. As such, djorm-cloud-jobs popularity was classified as not popular.
We found that djorm-cloud-jobs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.