taskorch 0.3.0

Concurrent Pool for task processing
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
use crate::{
    cond::{ArgIdx, CondAddr, Section, TaskId}, curry::CallOnce, log::{Level,LEVEL}, meta::{Fndecl, Identical, TupleAt, TupleCondAddr}, queue::{C1map, PostDo, WhenTupleComed}, task::{
        taskid_next, PsOf, Task, TaskCurrier, TaskMap, TaskNeed
    }, Queue
};

use std::{any::{type_name, Any, TypeId}, fmt::Debug, marker::PhantomData};

/// Represents how a value was inserted into the system or queue.
#[derive(Debug)]
pub enum Submission<Ps> {
    /// - `Added`: The task ID was not present; a new task was inserted.
    Added(TaskInf<Ps>),
    /// - `Updated`: The task ID already existed; the existing task was updated.
    Updated(TaskInf<Ps>),
}

impl<Ps> Submission<Ps> {
    /// Consumes self and returns the inner `TaskInf<Ps>`.
    pub const fn take(self)->TaskInf<Ps> {
        match self {
            Self::Added(taskinf) => taskinf,
            Self::Updated(taskinf) => taskinf,
        }
    }
}

/// Error type for task submission failures
#[derive(Debug, PartialEq)]
pub enum TaskSubmitError {
    /// when submit task, if the id has already existed in waitQueue.
    TaskIdAlreadyExists(TaskId),
}

/// Information about a submitted task
/// Holds the task ID and Input type info for the task's parameters
pub struct TaskInf<Ps> {
    taskid: TaskId,
    _phantom: PhantomData<Ps>,
}

impl<Ps> TaskInf<Ps> {
    pub(crate) const fn new(taskid:TaskId)->Self {
        Self { taskid, _phantom:PhantomData }
    }
    pub const fn taskid(&self)->TaskId {
        self.taskid
    }
}

impl<Args> TaskInf<Args> {
    /// Returns a `CondAddr` pointing to the `I`-th **input** parameter of the
    /// underlying task.
    ///
    /// # Examples
    ///
    /// ```rust
    /// # use taskorch::{Pool, TaskBuildNew, Queue};
    ///
    /// # let mut pool   = Pool::new();
    /// # let qid        = pool.insert_queue(&Queue::new()).unwrap();
    /// # let submitter  = pool.task_submitter(qid).unwrap();
    ///
    /// let task_inf   = submitter.submit((|a: i32, b: bool| 3).into_task()).take();
    /// println!("TaskInf: {task_inf:?}");
    ///
    /// let ca0 = task_inf.input_ca::<0>();
    /// let ca1 = task_inf.input_ca::<1>();
    /// println!("cond #0: {ca0:?}");
    /// println!("cond #1: {ca1:?}");
    /// ```
    ///
    /// # Type Parameters
    /// - `I`: zero-based index of the input parameter (`u8`).
    ///
    /// # Returns
    /// `CondAddr<Args::EleT>` locating the `I`-th input parameter.    
    pub fn input_ca<const I:u8>(&self)->CondAddr<Args::EleT>
    where Args:TupleAt<I> {
        CondAddr::from((self.taskid, Section::Input, ArgIdx::const_new::<I>()))
    }
}

impl<Args> Debug for TaskInf<Args> {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f,"TaskInf{{{:?},input<{}>}}",self.taskid(),type_name::<Args>())
    }
}

pub type SummitResult<Args> = Result<TaskInf<Args>,TaskSubmitError>;

/// a `submitter` is responsable for submitting tasks into System Queues.
/// You can create multiple submitters to submit tasks simultaneously.
#[derive(Clone)]
pub struct TaskSubmitter {
    #[allow(dead_code)]
    pub(crate) qid: usize, // just use in log
    pub(crate) queue: Queue,
    pub(crate) c1map: C1map,
}

impl TaskSubmitter {
    /// # submit(..)
    /// Enqueues a new task for future scheduling.
    /// Here, no error returns, always successfully.
    /// If the id does not exits, add.
    /// If the id has been exited, update.
    ///
    /// # Examples:
    /// ```rust
    /// # use taskorch::{Pool,TaskBuildNew,TaskId,ArgIdx,Queue,TaskSubmitError};
    /// # let mut pool = Pool::new();
    /// # let qid = pool.insert_queue(&Queue::new()).unwrap();
    /// # let submitter = pool.task_submitter(qid).unwrap();
    /// 
    /// // with explicit taskid=10
    /// let id10 = TaskId::from(10);
    /// let task = (|a:i32|3,id10).into_task();
    /// let task = submitter.submit(task).take();
    /// assert_eq!(task.taskid(),id10);
    /// println!("task inf: {task:?}");
    /// 
    /// // task without any parameters, taskid is optional
    /// let task = (||3).into_task();
    /// let task = submitter.submit(task).take();
    /// assert_eq!(task.taskid(),TaskId::NONE);
    /// // verify input_ca ???
    /// assert_eq!(task.input_ca::<0>().argidx(),&ArgIdx::<()>::AI0);
    /// println!("task inf: {task:?}");
    /// 
    /// // task without any parameter, but with explicit taskid = 1
    /// // still use the taskid you inputted even if it is not necessary.
    /// let id1 = 1.into();
    /// let task = (||3,id1).into_task();
    /// let task = submitter.submit(task).take(); 
    /// assert_eq!(task.taskid(),id1);
    /// println!("task inf: {task:?}");
    /// 
    /// // with explicit taskid = 10
    /// // error, because 10 is used above.
    /// let task = (||3,id10).into_task();
    /// let task = submitter.submit(task).take(); 
    /// assert_eq!(task.taskid(),id10);
    /// println!("task inf: {task:?}");
    /// ```
    ///
    /// # argments
    /// * `TaskNeed` - generate from `.into_task()` 
    /// 
    /// # returns
    /// * `Submission` see `Submission`
    /// * - when added Submission(Added(V))
    /// * - when updated Submission(Updated(V))
    /// 
    // TODO next: Optimize postdo: if no taskmap and no tofn, maybe use Option<postdo> to None
    // instead of always invoking it indiscriminately. (the present)
    #[allow(private_bounds)]
    pub fn submit<C,MapFn,MapR,ToFn>(&self,mut taskneed:TaskNeed<C,MapFn,MapFn::R,ToFn>)->Submission<C::InputPs>
        where
        TaskCurrier<C>: Task,
        C: CallOnce + Send + 'static,
        C::R: 'static + Debug,
        C: PsOf,

        MapFn: Fndecl<(C::R,),MapR> + Send + 'static,
        MapFn::Pt: From<(<C as CallOnce>::R,)>, // C::R === ? <C as CallOnce>::R
        MapFn::Pt: Identical<(<C as CallOnce>::R,)>,
        MapFn::R: TupleCondAddr + Clone,

        ToFn: Send + 'static,
        for<'a> ToFn: Fndecl<(&'a MapFn::R,),<MapFn::R as TupleCondAddr>::TCA>,
        for<'a> <ToFn as Fndecl<(&'a MapFn::R,), <MapFn::R as TupleCondAddr>::TCA>>::Pt: From<(&'a MapFn::R,)>,
        for<'d,'e> (
            &'d MapFn::R,
            &'e <MapFn::R as TupleCondAddr>::TCA,
            // &'b <ToFn as Fndecl<(&'a MapFn::R,), <MapFn::R as TupleCondAddr>::Cat>>::R,
        ): WhenTupleComed,
        // here if we use 'd to substitue the 'e, the error occurs. ???
        for<'a,'c> &'a <MapFn::R as TupleCondAddr>::TCA: From<&'a <ToFn as Fndecl<(&'c MapFn::R,), <MapFn::R as TupleCondAddr>::TCA>>::R>,
        // if subsitue the 2nd 'a with 'b, will lead to error???
        for<'a,'c> &'a <MapFn::R as TupleCondAddr>::TCA: Identical<&'a <ToFn as Fndecl<(&'c MapFn::R,), <MapFn::R as TupleCondAddr>::TCA>>::R>,
    {
        // postdo maybe added another param of taskid indicating where the value comes from.
        if 0 == taskneed.task.currier.count() {
            let taskid = taskneed.task.id;
            if LEVEL >= Level::Warn {
                if let TaskId(Some(_id)) = taskid {
                    warn!("Ignore the taskid {_id:?}: no conditions found for this task.");
                }
            }
            // if id is set we will check whether it is conflicted in map queue.
            if self.c1map.check(taskid).is_some() {
                warn!("task#{:?} has existed in queue!!",taskid);
            }

            let taskcompiled = self.compile(taskneed);
            self.queue.add_boxtask(taskcompiled);
            debug!("task#{:?} added into Q#{}", taskid, self.qid);
            Submission::Added(TaskInf::new(taskid))
        } else { // with parameters
             // @A, ensure, the task.id is nonzero.
            if taskneed.id().0.is_none() {
                taskneed.task.id = taskid_next();
            }
            // task.id must be some
            let TaskId(Some(taskid)) = taskneed.task.id else {
                unreachable!("task id has feeded in nonzero @A");
            };
            let taskcompiled = self.compile(taskneed);
            let inserted = self.c1map.insert(taskcompiled, taskid);
            if let crate::queue::Inserted::New = inserted {
                // debug_assert_eq!(Some(taskid),id);
                debug!("cond-task#{taskid:?} added into waitQueue");
                Submission::Added(TaskInf::new(TaskId(Some(taskid))))
            } else {
                warn!("cond-task#{taskid:?} is duplicated and updated in waitQueue!");
                Submission::Updated(TaskInf::new(TaskId(Some(taskid))))
            }
        }
    }

    /// Enqueues a task if not already present; otherwise returns an error.
    /// Differs from `submit` which updates existing tasks.
    ///
    /// # Examples:
    /// ```rust
    /// # use taskorch::{Pool,TaskBuildNew,TaskId,ArgIdx,Queue,TaskSubmitError};
    /// # let mut pool = Pool::new();
    /// # let qid = pool.insert_queue(&Queue::new()).unwrap();
    /// # let submitter = pool.task_submitter(qid).unwrap();
    /// 
    /// // with explicit taskid=10
    /// let id10 = TaskId::from(10);
    /// let task = (|a:i32|3,id10).into_task();
    /// let task = submitter.try_submit(task).unwrap();
    /// assert_eq!(task.taskid(),id10);
    /// println!("task inf: {task:?}");
    /// 
    /// // task without any parameters, taskid is optional
    /// let task = (||3).into_task();
    /// let task = submitter.try_submit(task).unwrap();
    /// assert_eq!(task.taskid(),TaskId::NONE);
    /// // verify input_ca ???
    /// assert_eq!(task.input_ca::<0>().argidx(),&ArgIdx::<()>::AI0);
    /// println!("task inf: {task:?}");
    /// 
    /// // task without any parameter, but with explicit taskid = 1
    /// // still use the taskid you inputted even if it is not necessary.
    /// let id1 = 1.into();
    /// let task = (||3,id1).into_task();
    /// let task = submitter.try_submit(task).unwrap(); 
    /// assert_eq!(task.taskid(),id1);
    /// println!("task inf: {task:?}");
    /// 
    /// // with explicit taskid = 10
    /// // error, because 10 is used above.
    /// let task = (||3,id10).into_task();
    /// let task = submitter.try_submit(task).unwrap_err(); 
    /// assert_eq!(task,TaskSubmitError::TaskIdAlreadyExists(id10));
    /// println!("task inf: {task:?}");
    /// ```
    ///
    /// # argments
    /// * `TaskNeed` - generate from `.into_task()` 
    /// 
    /// # returns
    /// * `SummitResult` - TaskInf or TaskError
    /// 
    /// * For parameterless tasks, an explicit ID is optional.
    /// * If provided, it is assigned to the task; otherwise, `NONE` is returned.
    /// 
    // TODO next: Optimize postdo: if no taskmap and no tofn, maybe use Option<postdo> to None
    // instead of always invoking it indiscriminately. (the present)
    #[allow(private_bounds)]
    pub fn try_submit<C,MapFn,MapR,ToFn>(&self,mut taskneed:TaskNeed<C,MapFn,MapFn::R,ToFn>)->SummitResult<C::InputPs>
        where
        TaskCurrier<C>: Task,
        C: CallOnce + Send + 'static,
        C::R: 'static + Debug,
        C: PsOf,

        MapFn: Fndecl<(C::R,),MapR> + Send + 'static,
        MapFn::Pt: From<(<C as CallOnce>::R,)>,
        MapFn::Pt: Identical<(<C as CallOnce>::R,)>,
        MapFn::R: TupleCondAddr + Clone,

        ToFn: Send + 'static,
        for<'a> ToFn: Fndecl<(&'a MapFn::R,),<MapFn::R as TupleCondAddr>::TCA>,
        for<'a> <ToFn as Fndecl<(&'a MapFn::R,), <MapFn::R as TupleCondAddr>::TCA>>::Pt: From<(&'a MapFn::R,)>,
        for<'d,'e> (
            &'d MapFn::R,
            &'e <MapFn::R as TupleCondAddr>::TCA,
            // &'b <ToFn as Fndecl<(&'a MapFn::R,), <MapFn::R as TupleCondAddr>::Cat>>::R,
        ): WhenTupleComed,
        // here if we use 'd to substitue the 'e, the error occurs. ???
        for<'a,'c> &'a <MapFn::R as TupleCondAddr>::TCA: From<&'a <ToFn as Fndecl<(&'c MapFn::R,), <MapFn::R as TupleCondAddr>::TCA>>::R>,
        // if subsitue the 2nd 'a with 'b, will lead to error???
        for<'a,'c> &'a <MapFn::R as TupleCondAddr>::TCA: Identical<&'a <ToFn as Fndecl<(&'c MapFn::R,), <MapFn::R as TupleCondAddr>::TCA>>::R>,
    {
        // postdo maybe added another param of taskid indicating where the value comes from.
        // without parameter
        if 0 == taskneed.task.currier.count() {
            let taskid = taskneed.task.id;
            if LEVEL >= Level::Warn {
                if let TaskId(Some(_id)) = taskid {
                    warn!("Ignore the taskid {_id:?}: no conditions found for this task.");
                }
            }
            // if id is set we will check whether it is conflicted in map queue.
            if self.c1map.check(taskid).is_some() {
                error!("task#{:?} has existed in queue!!",taskid);
                return Err(TaskSubmitError::TaskIdAlreadyExists(taskid))
            }

            let taskcompiled = self.compile(taskneed);
            self.queue.add_boxtask(taskcompiled);
            debug!("task#{:?} added into Q#{}", taskid, self.qid);
            Ok(TaskInf::new(taskid))
        } else { // with parameters
             // @A, ensure, the task.id is nonzero.
            if taskneed.id().0.is_none() {
                taskneed.task.id = taskid_next();
            }
            // task.id must be some
            let TaskId(Some(taskid)) = taskneed.task.id else {
                unreachable!("task id has feeded in nonzero @A");
            };
            let taskcompiled = self.compile(taskneed);
            let id = self.c1map.try_insert(taskcompiled, taskid);
            if id.is_some() {
                debug_assert_eq!(Some(taskid),id);
                debug!("cond-task#{taskid:?} added into waitQueue");
                Ok(TaskInf::new(TaskId(id)))
            } else {
                error!("cond-task#{taskid:?} is duplicated and can not be added into waitQueue!");
                Err(TaskSubmitError::TaskIdAlreadyExists(TaskId(Some(taskid))))
            }
        }
    }

    #[deprecated(
        since="0.3.0",
        note = "Use `submit()` instead for strict type check. \
               `old_submit()` will be removed in next release and not able to type in compling."
    )]
    #[allow(private_bounds)]
    pub fn old_submit<C,MapFn,MapR,ToFn>(&self,taskneed:TaskNeed<C,MapFn,MapFn::R,ToFn>)->TaskId
        where
        TaskCurrier<C>: Task,
        C: CallOnce + Send + 'static,
        C::R: 'static + Debug,
        C: PsOf,

        MapFn: Fndecl<(C::R,),MapR> + Send + 'static,
        MapFn::Pt: From<(<C as CallOnce>::R,)>,
        MapFn::Pt: Identical<(<C as CallOnce>::R,)>,
        MapFn::R: TupleCondAddr + Clone,

        ToFn: Send + 'static,
        for<'a> ToFn: Fndecl<(&'a MapFn::R,),<MapFn::R as TupleCondAddr>::TCA>,
        for<'a> <ToFn as Fndecl<(&'a MapFn::R,), <MapFn::R as TupleCondAddr>::TCA>>::Pt: From<(&'a MapFn::R,)>,
        for<'d,'e> (
            &'d MapFn::R,
            &'e <MapFn::R as TupleCondAddr>::TCA,
            // &'b <ToFn as Fndecl<(&'a MapFn::R,), <MapFn::R as TupleCondAddr>::Cat>>::R,
        ): WhenTupleComed,
        // here up if we use 'd to substitue the 'e, the error occurs. ???
        for<'a,'c> &'a <MapFn::R as TupleCondAddr>::TCA:
            // if subsitue the 2nd 'a with 'b, will lead to error???
            From<&'a <ToFn as Fndecl<(&'c MapFn::R,), <MapFn::R as TupleCondAddr>::TCA>>::R> +
            Identical<&'a <ToFn as Fndecl<(&'c MapFn::R,), <MapFn::R as TupleCondAddr>::TCA>>::R>,
    {
        self.submit(taskneed).take().taskid
    }


    #[allow(private_bounds)]
    fn compile<C,MapFn,MapR,ToFn>(&self,TaskNeed{task,map:TaskMap(mapfn),tofn,..}:TaskNeed<C,MapFn,MapFn::R,ToFn>)->(Box<dyn Task+Send>,Box<PostDo>)
        where
        TaskCurrier<C>: Task,
        C: CallOnce + Send + 'static,
        C::R: 'static + Debug,
        C: PsOf,

        MapFn: Fndecl<(C::R,),MapR> + Send + 'static,
        MapFn::Pt: From<(<C as CallOnce>::R,)>,
        MapFn::Pt: Identical<(<C as CallOnce>::R,)>,
        MapFn::R: TupleCondAddr + Clone,

        ToFn: Send + 'static,
        for<'a> ToFn: Fndecl<(&'a MapFn::R,),<MapFn::R as TupleCondAddr>::TCA>,
        for<'a> <ToFn as Fndecl<(&'a MapFn::R,), <MapFn::R as TupleCondAddr>::TCA>>::Pt: From<(&'a MapFn::R,)>,
        for<'d,'e> (
            &'d MapFn::R,
            &'e <MapFn::R as TupleCondAddr>::TCA,
            // &'b <ToFn as Fndecl<(&'a MapFn::R,), <MapFn::R as TupleCondAddr>::Cat>>::R,
        ): WhenTupleComed,
        // here if we use 'd to substitue the 'e, the error occurs. ???
        for<'a,'c> &'a <MapFn::R as TupleCondAddr>::TCA: From<&'a <ToFn as Fndecl<(&'c MapFn::R,), <MapFn::R as TupleCondAddr>::TCA>>::R>,
        // if subsitue the 2nd 'a with 'b, will lead to error???
        for<'a,'c> &'a <MapFn::R as TupleCondAddr>::TCA: Identical<&'a <ToFn as Fndecl<(&'c MapFn::R,), <MapFn::R as TupleCondAddr>::TCA>>::R>,
    {
        let mk_postdo = |id:TaskId| {
            let c1map = self.c1map.clone();
            let c1queue = (self.qid,self.queue.clone());
            let postdo = move |r: Box<dyn Any>| {
                let r_from = &id;
                let _actual_type = r.type_id();
                let Ok(r) = r.downcast::<C::R>() else {
                    let _expected_type = TypeId::of::<C::R>();
                    let _expected_type_name = std::any::type_name::<C::R>();
                    error!(
                        "task return value downcast failed: expected {}, got {:?}",
                        _expected_type_name, _actual_type
                    );
                    panic!("failed to conver to R type");
                    // return;
                };
                let r: C::R = *r;
                let rtuple = mapfn.call((r,).into());
                let rcondaddr = tofn.call(ToFn::Pt::from((&rtuple,)));
                (&rtuple, (&rcondaddr).into()).foreach(r_from, c1map, c1queue);

                // if the 'd and 'e is replaced by 'd, here will occer error.
                // because, the lifecycle of &rtuple and &rcondaddr are equal from func signatures.
                // but actually 
                // submitter.rs(110, 13): `rcondaddr` dropped here while still borrowed
                // drop(rcondaddr);
                // drop(rtuple); 
            };
            postdo
        };

        let taskid = task.id;
        let taskdo = Box::new(task);
        let postdo = Box::new(mk_postdo(taskid));
        (taskdo,postdo)
    }
}

#[cfg(test)]
impl TaskSubmitter {
    fn test_new() -> Self {
        Self {
            qid: 1,
            queue: Queue::new(),
            c1map: C1map::new(),
        }
    }
}

#[test]
fn test_conv() {
    use std::any::Any;
    let a = 3i32;
    let a: &dyn Any = &a;
    let b = a.downcast_ref::<i32>();
    assert!(b.is_some());
    let b = a.downcast_ref::<i8>();
    assert!(b.is_none());
    let b = a.downcast_ref::<i64>();
    assert!(b.is_none());
}


#[test]
fn test_submmit() {
    use crate::task::TaskBuildNew;
    let s = TaskSubmitter::test_new();

    // first is the new
    let id1 = TaskId::new(1);
    let task = (|_:i32|(),id1).into_task();
    let task = s.try_submit(task);
    println!("i32:{}",type_name::<i32>());
    println!("debug of task: {task:?}");
    assert!(task.is_ok_and(|a|a.taskid()==id1));

    // repeat insert into task with same taskid, leading to an Err
    let task = (|_:i8|(),id1).into_task();
    let task = s.try_submit(task);
    println!("debug of task: {task:?}");
    assert!(
        task.is_err_and( |e| matches!( e, TaskSubmitError::TaskIdAlreadyExists(id) if {id==id1} ) )
    );

    // still the same taskid
    let task = (|_:i8|(),id1).into_task();
    let task = s.submit(task);
    println!("debug of task: {task:?}");
    assert!(matches!(task,Submission::Updated(_)));

    // new task id
    let id2 = TaskId::new(2);
    let task = (|_:i8|(),id2).into_task();
    let task = s.submit(task);
    println!("debug of task: {task:?}");
    assert!(matches!(task,Submission::Added(inf) if inf.taskid == id2));
}

#[test]
fn test_taskinf() {
    let _taskinf = TaskInf::<(i32,)>::new(TaskId::new(3));
}