Major changes: - New frontend (platform/web/): Vite + React 18 + TypeScript + Tailwind - 4-module navigation: 数据送标 / 模型管理 / 车队管理 / 系统管理 - Data catalog with charts (DMS/ADAS/Lane 3-tab view) - Quality review workflow (标注质检): Good/Fine/Bad scoring with auto-advance - Audit enhancements: batch operations, rejection categories, Feishu notifications - Operation audit log (操作日志) - World model simulation studio (仿真工坊) - Dataset version management with snapshots and diff - ADAS 7-class dataset integration (138K images organized + compressed) - User management with Feishu integration and pagination - CRUD/search/filter on all pages, card layout redesign - PIL-optimized image overlay rendering - Auto-snapshot on build, in_review workflow stage - Removed embedded algorithm code (now in workspace)
84 lines
1.4 KiB
TypeScript
84 lines
1.4 KiB
TypeScript
import * as fastq from '../'
|
|
import { promise as queueAsPromised } from '../'
|
|
|
|
// Basic example
|
|
|
|
const queue = fastq(worker, 1)
|
|
|
|
queue.push('world', (err, result) => {
|
|
if (err) throw err
|
|
console.log('the result is', result)
|
|
})
|
|
|
|
queue.push('push without cb')
|
|
|
|
queue.concurrency
|
|
|
|
queue.drain()
|
|
|
|
queue.empty = () => undefined
|
|
|
|
console.log('the queue tasks are', queue.getQueue())
|
|
|
|
queue.idle()
|
|
|
|
queue.kill()
|
|
|
|
queue.killAndDrain()
|
|
|
|
queue.length
|
|
|
|
queue.pause()
|
|
|
|
queue.resume()
|
|
|
|
queue.running()
|
|
|
|
queue.saturated = () => undefined
|
|
|
|
queue.unshift('world', (err, result) => {
|
|
if (err) throw err
|
|
console.log('the result is', result)
|
|
})
|
|
|
|
queue.unshift('unshift without cb')
|
|
|
|
function worker(task: any, cb: fastq.done) {
|
|
cb(null, 'hello ' + task)
|
|
}
|
|
|
|
// Generics example
|
|
|
|
interface GenericsContext {
|
|
base: number;
|
|
}
|
|
|
|
const genericsQueue = fastq<GenericsContext, number, string>({ base: 6 }, genericsWorker, 1)
|
|
|
|
genericsQueue.push(7, (err, done) => {
|
|
if (err) throw err
|
|
console.log('the result is', done)
|
|
})
|
|
|
|
genericsQueue.unshift(7, (err, done) => {
|
|
if (err) throw err
|
|
console.log('the result is', done)
|
|
})
|
|
|
|
function genericsWorker(this: GenericsContext, task: number, cb: fastq.done<string>) {
|
|
cb(null, 'the meaning of life is ' + (this.base * task))
|
|
}
|
|
|
|
const queue2 = queueAsPromised(asyncWorker, 1)
|
|
|
|
async function asyncWorker(task: any) {
|
|
return 'hello ' + task
|
|
}
|
|
|
|
async function run () {
|
|
await queue.push(42)
|
|
await queue.unshift(42)
|
|
}
|
|
|
|
run()
|