Skip to main content
Version: latest

Task Management

A Task is the actual running instance of a Job's definition in Kubernetes.

Access to Tasks provides you with visibility and control of system jobs that are running on your cluster.

System jobs include (but are not limited to) the following:

  • Data Source ingestion
  • Profile building
  • Mission simulation

Task Statuses

  • COMPLETED: The task has finished running successfully.
  • FAILED: The task has stopped running, but it has not completed successfully.
  • PENDING: The task is in progress, queuing or queued.
  • Active: The task is running in Kubernetes.
  • PAUSED: (For scheduled task) The task has been paused. Action must be taken by the user to resume the schedule.

Get a list of Tasks

To get a list of all Tasks for a specified Project run:

cortex tasks list --project projectName

Example Response

┌───────────────┬─────────────┬─────────────────┬──────────┬───────────────┬────────────┐
│ Name │ Skill Name │ Action Name │ Status │ Started │ Schedule │
├───────────────┼─────────────┼─────────────────┼──────────┼───────────────┼────────────┤
│ myAgent-job │ mySkill │ invoke │ Active │ 3 hours ago │ * * * * * │
├───────────────┼─────────────┼─────────────────┼──────────┼───────────────┼────────────┤
│ myAgent2-job │ mySkill2 │ invoke │ PAUSED │ 18 minutes ago│ * * * * * │
└─────────────────────────────┴─────────────────┴──────────┴───────────────┴────────────┘

NOTE: you can get a list of scheduled tasks by adding the --scheduled option to the query.

cortex tasks list --scheduled

Get the details of a Task

cortex tasks get taskId --project projectName

OR

cortex tasks describe taskId --project projectName

Example Response (for Data Source ingestion Task)

{
"success": true,
"task": {
"spec": {
"actionName": "amp-cli",
"activationId": "643cdbf7-70be-45d3-88c0-bab63ea761c0",
"resources": {},
"skillName": "643cdbf7-70be-45d3-88c0-bab63ea761c0",
"taskPoolName": "default",
"token": "eyJraWQiOiJmODA0S0UwcHlnbmpOcVdvb0h4OFNWdHk3ZjZDTEdidDJiRDdEeV8wM3YwIiwiYWxnIjoiRWREU0EifQ.eyJiZWFyZXIiOiJ1c2VyIiwiaWF0IjoxNjQyNDAyNzEyLCJleHAiOjE2NDI0ODkxMTMsInJvbGVzIjpbImNvcnRleC1hZG1pbnMiXSwic3ViIjoiY29ydGV4QGV4YW1wbGUuY29tIiwiYXVkIjoiY29ydGV4IiwiaXNzIjoiY29nbml0aXZlc2NhbGUuY29tIn0.ewoLlciPIYnMEdOpzU2Re-tUqBnknYA37cTG3xXUMyydYpKd1gA16eDXKBiWsc6TJ7hf6dd3qDWNfVAvMLkEDQ"
},
"name": "643cdbf7-70be-45d3-88c0-bab63ea761c0",
"labels": {
"fabric.jobtype": "ingest-source",
"fabric.project": "poojapractice-c4cfd",
"fabric.resname": "multilinedatas-88cd8",
"fabric.restype": "DataSource",
"fabric.source": "api-service"
}
}
}

Schedule Tasks

You can schedule an Agent task to be triggered at specified times by adding scheduling options to the payload when you invoke the Agent. Task scheduling uses cron notation.

  1. Deploy an Agent.

  2. Invoke the Agent adding the scheduling options --scheduleCron <cron> and optionally, --scheduleName <name> to the payload.

    EXAMPLES:

    cortex agents invoke agentName input --params '{"payload":{"text":"test cron"}}' --scheduleCron "* * * * *"

    OR

    cortex agents invoke agentName input --params '{"payload":{"text":"test cron"}}' --scheduleCron "@hourly" --scheduleName "hubble_hourly"

Pause and Restart Scheduled Tasks

To pause a scheduled task run:

cortex tasks pauseSchedule myAgent --project myProject

Response:

{"success":true,"message":"Successfully paused task \"myAgent-20e89\""}

To resume running a paused task run:

cortex tasks resumeSchedule myAgent-20e89 --project myProject

Response:

{"success":true,"message":"Successfully resumed task \"myAgent-20e89\""}

Unschedule a Task

To remove the schedule from a Task run:

cortex tasks delete myAgent-20e89 --project myProject

Response:

{"success":true,"message":"Successfully marked task myAgent-20e89 for delete"}

Get the Logs for Tasks

To get logs from Tasks running in a specified project:

cortex tasks logs taskId --project projectName

Example Response

"2022-03-23T14:10:39Z scuttle: Scuttle 1.3.6 starting up, pid 1\n2022-03-23T14:10:39Z scuttle: Logging is now enabled\n2022-03-23T14:10:39Z scuttle: Blocking until Envoy starts\n2022-03-23T14:10:39Z scuttle: Polling Envoy (1), error: internal_service: dial tcp 127.0.0.1:15000: connect: connection refused\n2022-03-23T14:10:39Z scuttle: Blocking finished, Envoy has started\n ______     ______     ______     ______   ______     __  __\n/\\  ___\\   /\\  __ \\   /\\  == \\   /\\__  _\\ /\\  ___\\   /\\_\\_\\_\\\n\\ \\ \\____  \\ \\ \\/\\ \\  \\ \\  __<   \\/_/\\ \\/ \\ \\  __\\   \\/_/\\_\\/_\n \\ \\_____\\  \\ \\_____\\  \\ \\_\\ \\_\\    \\ \\_\\  \\ \\_____\\   /\\_\\/\\_\\\n  \\/_____/   \\/_____/   \\/_/ /_/     \\/_/   \\/_____/   \\/_/\\/_/\n\nCortex Phoenix CLI v6.0.0\n\n{\"@timestamp\":\"23-03-2022 14:10:41.760\",\"@level\":\"INFO\",\"@thread\":\"main\",\"@logger\":\"com.c12e.cortex.phoenix.cli.ApplicationKt\",\"@message\":\"Starting ApplicationKt using Java 11.0.14.1 on 82387672-8286-4583-bd3a-4d2f9a7d1794-pgw5n with PID 14 (/app/libs/api-cli.jar started by default in /app)\",\"@context\":\"default\"}\n{\"@timestamp\":\"23-03-2022 14:10:41.781\",\"@level\":\"DEBUG\",\"@thread\":\"main\",\"@logger\":\"com.c12e.cortex.phoenix.cli.ApplicationKt\",\"@message\":\"Running with Spring Boot v2.4.1, Spring v5.3.2\",\"@context\":\"default\"}\n{\"@timestamp\":\"23-03-2022 14:10:41.782\",\"@level\":\"INFO\",\"@thread\":\"main\",\"@logger\":\"com.c12e.cortex.phoenix.cli.ApplicationKt\",\"@message\":\"No active profile set, falling back to default profiles: default\",\"@context\":\"default\"}\n{\"@timestamp\":\"23-03-2022 14:10:43.538\",\"@level\":\"INFO\",\"@thread\":\"main\",\"@logger\":\"org.springframework.data.repository.config.RepositoryConfigurationDelegate\",\"@message\":\"Multiple Spring Data modules found, entering strict repository configuration mode!\",\"@context\":\"default\"}\n{\"@timestamp\":\"23-03-2022 14:10:43.542\" ...

Delete a Task

Deleting a Task stops the running Task and logs will not be available for the Task.

cortex tasks delete <task-name>

Example Response

{"success":true,"message":"Successfully marked task 1c7cfe67-c8d3-408c-9d63-168cfbde7090 for delete"}