MCPServer/TaskTypes

From Archivematica
< MCPServer
Revision as of 17:00, 7 March 2018 by Sevein (talk | contribs)
Jump to navigation Jump to search

Main Page > Development > Development documentation > MCPServer > TaskTypes

Design

This page proposes a new feature and reviews design options

Development

This page describes a feature that's in development

Documentation

This page documents an implemented feature

For each MicroServiceChainLink in the MCP Server , the TaskType determines what code will be executed for that task. There are 13 task types.

Reading about the MCP Server is highly recommended to understand this page.

General

Run once

  • UUID: 36b2e239-4a57-4aa5-8ebc-7a29139baca6
  • Description in TaskTypes: one instance
  • LinkTaskMananger: linkTaskManagerDirectories
  • TaskTypePKReference: Foreign key to StandardTasksConfigs

Run the command listed in StandardTasksConfigs exactly once. TODO filterSubDir?

Run for each file

  • UUID: a6b1c323-7d36-428e-846a-e7e819423577
  • Description in TaskTypes: for each file
  • LinkTaskMananger: linkTaskManagerFiles
  • TaskTypePKReference: Foreign key to StandardTasksConfigs

Run the command once for each file associated with that Unit (SIP, DIP, Transfer). Files can be filtered using filterFileEnd, filterFileStart (works on the basename of the file) or filterSubDir (selects only files in those directories)

User Choice

Get User Choice - select chain

  • UUID: 61fb3874-8ef6-49d3-8a2d-3cb66e86a30c
  • Description in TaskTypes: get user choice to proceed with
  • LinkTaskMananger: linkTaskManagerChoice
  • TaskTypePKReference: Foreign key to MicroServiceChainChoice
  • Use Case: Run different MicroServiceChains based on user input

Run a MicroServiceChain, depending on what the user chooses. Each MicroServiceChainChoice knows where it should be displayed (choiceAvailableAtLink), and what chain to run if it is selected (chainAvailable). The text to display comes from MicroServiceChains.description, as does the MicroServiceChainLink to run (MicroServiceChains.startingLink)

Get User Choice - select replacement dict

  • UUID: 9c84b047-9a6d-463f-9836-eafa49743b84
  • Description in TaskTypes: get replacement dic from user choice
  • LinkTaskMananger: linkTaskManagerReplacementDicFromChoice
  • TaskTypePKReference: Foreign key to MicroServiceChoiceReplacementDic
  • Use Case: Run the same MicroServiceChainLinks in all cases, but with slightly different behavior based on user input, and you know all the options ahead of time. Adds the user choice as a replacement variable.

Adds a new replacement dict and value for the rest of the chain. Future commands can use replacement %FOO% in their StandardTaskConfigs.arguments, and it will be replaced by the user's choice. Each MicroServiceChoiceReplacementDic knows where it should be displayed (choiceAvailableAtLink), what text to display (description) and what replacement variables to add (replacementDic).

NOTE: The replacement variables no longer disappear when a new MicroServiceChain is started.

Generate User Choice in MicroService

  • UUID: a19bfd9f-9989-4648-9351-013a10b382ed
  • Description in TaskTypes: Get microservice generated list in stdOut
  • LinkTaskMananger: linkTaskManagerGetMicroserviceGeneratedListInStdOut
  • TaskTypePKReference: Foreign key to StandardTasksConfigs
  • Use Case: Run the same MicroServiceChainLinks in all cases, but with slightly different behavior based on user input, and you need to get the options at run time. Requires #Get User Choice - select from MicroService Generated List

Takes the output (stdout) of the command run, evaluates it into a single python object, and adds it to the chain's passVar as a choicesDic. The output is almost always a dict of {'choice to display':'value for replacement dict'}.

Get User Choice - select from MicroService Generated List

  • UUID: 01b748fe-2e9d-44e4-ae5d-113f74c9a0ba
  • Description in TaskTypes: Get user choice from microservice generated list
  • LinkTaskMananger: linkTaskManagerGetUserChoiceFromMicroserviceGeneratedList
  • TaskTypePKReference: Foreign key to StandardTasksConfigs
  • Use Case: Run the same MicroServiceChainLinks in all cases, but with slightly different behavior based on user input, and you need to get the options at run time. Adds the user choice as a replacement variable. Requires #Get User Choice - select from MicroService Generated List

Looks for a choicesDic in the passVar, and displays the choices to the user. Values to display are the choicesDic keys, and the choicesDic value is put in a replacement variable specified in StandardTasksConfig.execute.

NOTE: The replacement variables no longer disappear when a new MicroServiceChain is started, because the Unit is recreated.

Unit Variables

Set Unit Variable

  • UUID: 6f0b612c-867f-4dfd-8e43-5b35b7f882d7
  • Description in TaskTypes: linkTaskManagerSetUnitVariable
  • LinkTaskMananger: linkTaskManagerSetUnitVariable
  • TaskTypePKReference: Foreign key to TasksConfigsSetUnitVariable

For SIPs and Transfers only. Inserts an entry into UnitVariables with a foreign key back to the SIP or Transfer, and values 'variable', 'variableValue' and 'microServiceChainLink' from TasksConfigsSetUnitVariable. Unit variables can be accessed by any microservice and used as a permanent store associated with a unit. The UnitVariables.microServiceChainLink is usually used by get unit variable to determine which MicroServiceChainLink to run next.

Get Unit Variable MicroServiceChainLink

  • UUID: c42184a3-1a7f-4c4d-b380-15d8d97fdd11
  • Description in TaskTypes: linkTaskManagerUnitVariableLinkPull
  • LinkTaskMananger: linkTaskManagerUnitVariableLinkPull
  • TaskTypePKReference: Foreign key to TasksConfigsUnitVariableLinkPull

For SIPs and Transfers only. Looks in the UnitVariables table for variable with the correct name associated with the unit. If one is found, go to the microServiceChainLink specified, otherwise go to the defaultMicroServiceChainLink.

Transcoding - Removed

Split based on File - Removed

  • UUID: 75cf8446-1cb0-474c-8245-75850d328e91
  • Description in TaskTypes: Split creating Jobs for each file
  • LinkTaskMananger: linkTaskManagerSplit
  • TaskTypePKReference: Foreign key to TasksConfigsStartLinkForEachFile

Part of the pre-FPR way of handling transcoding. Removed - documentation kept for historical reasons.

Split based on File and Ruleset - Removed

  • UUID: 405b061b-361e-4e75-be27-834a1bc25f5c
  • Description in TaskTypes: Split Job into many links based on file ID
  • LinkTaskMananger: linkTaskManagerSplitOnFileIdAndruleset
  • TaskTypePKReference: Foreign key to StandardTasksConfigs

Part of the pre-FPR way of handling transcoding. Removed - documentation kept for historical reasons.

Transcode - Removed

  • UUID: 5e70152a-9c5b-4c17-b823-c9298c546eeb
  • Description in TaskTypes: Transcoder task type
  • LinkTaskMananger: linkTaskManagerTranscoderCommand
  • TaskTypePKReference: Foreign key to CommandRelationships

Part of the pre-FPR way of handling transcoding. Removed - documentation kept for historical reasons.

Magic Links - Deprecated

Removed in https://github.com/artefactual/archivematica/pull/948, will be part of Archivematica v1.8.0.

Set Magic Link - Deprecated

  • UUID: 3590f73d-5eb0-44a0-91a6-5b2db6655889
  • Description in TaskTypes: assign magic link
  • LinkTaskMananger: linkTaskManagerAssignMagicLink
  • TaskTypePKReference: Foreign key to TasksConfigsAssignMagicLink

For SIPs and Transfers only. Sets the SIPs.magicLink or Transfers.magicLink to TasksConfigsAssignMagicLink.execute, and magicLinkExitMessage to the default value of "Completed successfully". Next time Get Magic Link is called, it will go to that MicroServiceChainLink.

Get Magic Link - Deprecated

  • UUID: 6fe259c2-459d-4d4b-81a4-1b9daf7ee2e9
  • Description in TaskTypes: goto magic link
  • LinkTaskMananger: linkTaskManagerLoadMagicLink
  • TaskTypePKReference: NULL

For SIPs and Transfers only, looks at magicLink and magicLinkExitMessage in the SIPs or Transfers table, and goes to that link.