@haxall/haxall
    Preparing search index...

    Class TaskFuncs

    Task module Axon functions

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    type$: Type

    Methods

    • Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object:

      this < that   =>  <0
      this == that => 0
      this > that => >0

      This method may also be accessed via the < <= <=> >= and > shortcut operators. If not overridden the default implementation compares the toStr representations. Also see docLang.

      Examples:

      3.compare(8)  =>  -1
      8.compare(3) => 1
      8.compare(8) => 0
      3 <=> 8 => -1 // shortcut for 3.compare(8)

      Parameters

      Returns number

    • Compare this object to the specified for equality. This method may be accessed via the == and != shortcut operators. If not overridden the default implementation compares for reference equality using the === operator. If this method is overridden, then hash() must also be overridden such that any two objects which return true for equals() must return the same value for hash(). This method must accept null and return false.

      Parameters

      Returns boolean

    • Return a unique hashcode for this object. If a class overrides hash() then it must ensure if equals() returns true for any two objects then they have same hash code.

      Returns number

    • Return if this Obj is immutable and safe to share between threads:

      • an instance of a const class
      • the result of toImmutable on List, Map, or Buf
      • a Func object may or may not be immutable - see sys::Func.
      • other instances are assumed mutable and return false

      Returns boolean

    • Get an immutable representation of this instance or throw NotImmutableErr if this object cannot be represented as an immutable:

      • if type is const, return this
      • if already an immutable List, Map, Buf, or Func return this
      • if a List, then attempt to perform a deep clone by calling toImmutable on all items
      • if a Map, then attempt to perform a deep clone by calling toImmutable on all values (keys are already immutable)
      • some Funcs can be made immutable - see sys::Func
      • if a Buf create immutable copy, see sys::Buf
      • any other object throws NotImmutableErr

      Returns Readonly<this>

    • Return a string representation of this object.

      Returns string

    • Trap a dynamic call for handling. Dynamic calls are invoked with the -> shortcut operator:

      a->x        a.trap("x", null)
      a->x() a.trap("x", null)
      a->x = b a.trap("x", [b])
      a->x(b) a.trap("x", [b])
      a->x(b, c) a.trap("x", [b, c])

      The default implementation provided by Obj attempts to use reflection. If name maps to a method, it is invoked with the specified arguments. If name maps to a field and args.size is zero, get the field. If name maps to a field and args.size is one, set the field and return args[0]. Otherwise throw UnknownSlotErr.

      Parameters

      Returns JsObj

    • Get the Type instance which represents this object's class. Also seeType.of or Pod.of.

      Returns Type

    • This method called whenever an it-block is applied to an object. The default implementation calls the function with this, and then returns this.

      Parameters

      • f: (arg0: this) => void

      Returns this

    • Write x.toStr to standard output followed by newline. If x is null then print "null". If no argument is provided then print an empty line.

      Parameters

      Returns void

    • Cancel a future. If the message is still queued then its removed from the actor's queue and will not be processed. No guarantee is made that the message will not be processed. See lib-task::doc#futures.

      Parameters

      Returns JsObj

    • Block current thread until a future's result is ready. A null timeout will block forever. If an exception was raised by the asynchronous computation, then it is raised to the caller. See lib-task::doc#futures.

      Parameters

      Returns JsObj

    • Return if a future has completed or is still pending a result. A future is completed by any of the following conditions:

      • the task processes the message and returns a result
      • the task processes the message and raises an exception
      • the future is cancelled See lib-task::doc#futures.

      Parameters

      Returns boolean

    • Return current state of a future as one of the following strings:

      • pending: still queued or being processed
      • ok: completed with result value
      • err: completed with an exception
      • cancelled: future was cancelled before processing See lib-task::doc#futures.

      Parameters

      Returns string

    • Block until a future transitions to a completed state (ok, err, or canceled). If timeout is null then block forever, otherwise raise a TimeoutErr if timeout elapses. Return future. See lib-task::doc#futures.

      Parameters

      Returns Future

    • Block on a list of futures until they all transition to a completed state. If timeout is null block forever, otherwise raise TimeoutErr if any one of the futures does not complete before the timeout elapses. See lib-task::doc#futures.

      Parameters

      Returns List<Future>

    • Parameters

      • ...args: unknown[]

      Returns TaskFuncs

    • Lookup a task by id which is any value supported by toRecId().

      Parameters

      • id: JsObj
      • Optionalchecked: boolean

      Returns Task

    • Set cancel flag for the given task. Cancelling a task sets an internal flag which is checked by the context's heartbeat on every Axon call. On the next Axon call the current message context will raise a sys::CancelledErr which will be raised by the respective future. Cancelling a task does not interrupt any current operations, so any blocking future or I/O calls should always use a timeout.

      Parameters

      Returns void

    • Return current task if running within the context of an asynchronous task. If context is not within a task, then return null or raise an exception based on checked flag.

      Parameters

      • Optionalchecked: boolean

      Returns Task

    • Is the current context running asynchrounsly inside a task

      Returns boolean

    • Get a task local variable by name or def if not defined. Must be running in a task context. See lib-task::doc#locals.

      Parameters

      • name: string
      • Optionaldef: JsObj

      Returns JsObj

    • Remove a task local variable by name. Must be running in a task context. See lib-task::doc#locals.

      Parameters

      • name: string

      Returns JsObj

    • Set a task local variable. The name must be a valid tag name. Must be running in a task context. See lib-task::doc#locals.

      Parameters

      Returns JsObj

    • Update the current running task's progress data with given dict. This is a silent no-op if the current context is not running in a task.

      Example:

      // report progress percentage processing a list of records
      recs.each((rec, index)=>do
      taskProgress({percent: round(100%*index/recs.size), cur:rec.dis})
      processRec(rec)
      end)
      taskProgress({percent:100%})

      Parameters

      Returns JsObj

    • Refresh the user account used for tasks

      Returns void

    • Restart a task. This kills the tasks and discards any pending messages in its queue. See lib-task::doc#lifecycle.

      Parameters

      Returns Task

    • Run the given expression asynchronously in an ephemeral task. Return a future to track the asynchronous result. Note the expr passed cannot use any variables from the current scope. See lib-task::doc#ephemeralTasks.

      Parameters

      Returns Future

    • List the current tasks as a grid. The format of this grid is subject to change.

      Parameters

      Returns Grid

    • Asynchronously send a message to the given task for processing. Return a future to track the asynchronous result. See lib-task::doc#messaging.

      Parameters

      Returns Future

    • Schedule a message for delivery after the specified period of duration has elapsed. Once the period has elapsed the message is appended to the end of the task's queue. Return a future to track the asynchronous result. See lib-task::doc#messaging.

      Parameters

      Returns Future

    • Schedule a message for delivery after the given future has completed. Completion may be due to the future returning a result, throwing an exception, or cancellation. Return a future to track the asynchronous result. See lib-task::doc#messaging.

      Parameters

      Returns Future

    • Sleep for the given duration. If not currently running in a task this is a no-op. This will block the current task's thread and prevent other tasks from using it until the sleep completes. So this function should be used sparingly and with care.

      Parameters

      Returns void