Difference between revisions of "MCPServer/TaskTypes"

From Archivematica
Jump to navigation Jump to search
 
(14 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
[[Main Page]] > [[Development]] > [[:Category:Development documentation|Development documentation]] > [[MCPServer]] > TaskTypes
  
* [[MCP/TaskTypes/one_instance]]
+
<div style="padding: 10px 10px; border: 1px solid black; background-color: #F79086;">This page is no longer being maintained and may contain inaccurate information. Please see the [https://www.archivematica.org/docs/latest/ Archivematica documentation] for up-to-date information. </div> <p>
* [[MCP/TaskTypes/for_each_file]]
 
* [[MCP/TaskTypes/magic_links]]
 
  
* [[MCP/TaskTypes/unit_variables]]
+
<div class="status">
 +
<div>
 +
Design
 +
<div class="description">
 +
This page proposes a new feature and reviews design options
 +
</div>
 +
</div><div>
 +
Development
 +
<div class="description">
 +
This page describes a feature that's in development
 +
</div>
 +
</div><div class="active">
 +
Documentation
 +
<div class="description">
 +
This page documents an implemented feature
 +
</div>
 +
</div>
 +
</div>
  
* [[MCP/TaskTypes/get_user_choice_to_proceed_with]]
+
For each '''MicroServiceChainLink''' in the [[MCPServer | MCP Server ]], the TaskType determines what code will be executed for that task.  There are 13 task types.
* [[MCP/TaskTypes/get_replacement_dic_from_user_choice]]
 
  
 +
Reading about the [[MCPServer | MCP Server]] is highly recommended to understand this page.
  
* [[MCP/TaskTypes/Get_microservice_generated_list_in_stdOut]]
+
== General ==
* [[MCP/TaskTypes/Get_user_choice_from_microservice_generated_list]]
+
=== Run once ===
 +
* '''UUID''': 36b2e239-4a57-4aa5-8ebc-7a29139baca6
 +
* '''Description in TaskTypes''': one instance
 +
* '''LinkTaskMananger''': linkTaskManagerDirectories
 +
* '''TaskTypePKReference''': Foreign key to [[ MCPServer#StandardTasksConfigs | 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 [[ MCPServer#StandardTasksConfigs | 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)
  
* [[MCP/TaskTypes/Split_creating_Jobs_for_each_file]]
+
== User Choice ==
* [[MCP/TaskTypes/Split_Job_into_many_links_based_on_file_ID]]
+
 
* [[MCP/TaskTypes/Transcoder_task_type]]
+
=== 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 [[ MCPServer#MicroServiceChainChoice | 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 [[ MCPServer#MicroServiceChoiceReplacementDic | 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 [[ MCPServer#StandardTasksConfigs | 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 [[ MCPServer#StandardTasksConfigs | 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 [[ MCPServer#TasksConfigsSetUnitVariable | 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 MicroServiceChainLink | 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 [[ MCPServer#TasksConfigsUnitVariableLinkPull | 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 [[ MCPServer#TasksConfigsStartLinkForEachFile | 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 [[ MCPServer#StandardTasksConfigs | 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 [[ MCPServer#CommandRelationships | 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 [[ MCPServer#TasksConfigsAssignMagicLink | 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.
 +
 
 +
 
 +
[[Category:Development documentation]]

Latest revision as of 16:57, 11 February 2020

Main Page > Development > Development documentation > MCPServer > TaskTypes

This page is no longer being maintained and may contain inaccurate information. Please see the Archivematica documentation for up-to-date information.

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[edit]

Run once[edit]

  • 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[edit]

  • 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[edit]

Get User Choice - select chain[edit]

  • 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[edit]

  • 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[edit]

  • 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[edit]

  • 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[edit]

Set Unit Variable[edit]

  • 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[edit]

  • 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[edit]

Split based on File - Removed[edit]

  • 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[edit]

  • 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[edit]

  • 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[edit]

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

Set Magic Link - Deprecated[edit]

  • 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[edit]

  • 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.