-
Notifications
You must be signed in to change notification settings - Fork 1
OLD_3. prosEO CLI: command [mission]
The command mission gives the ability to the users to create and/or configure an Earth Observation Mission. The command has 5 mandatory sub-commands that have different purposes: show, create, update, delete, spacecraft.
Important points:
- As stated in description of the login command, the only sub-command that works without login is the sub-command show
- In order to use the sub-command [mission] create, the user must have administrative privileges. This means that only some user accounts are allowed to create missions. After the creation of the mission, the administration account has the option to create a dedicated user account for the newly created mission.
Info:
The commands user/group exist to provide a dedicated level of privileges.
The syntax for the mission command and its sub-commands is available here.
In case the users enter information after the final parameter, the system returns an error message as shown below:
prosEO (NM4T)> mission show test extraparameter
(E2914) Too many parameters for command show
prosEO (NM4T)>
In case the users enter a wrong sub-command, the system returns an error message that the sub-command is not valid:
prosEO (NM4T)> mission wrongsubcommand test
(E2917) Illegal subcommand wrongsubcommand
prosEO (NM4T)>
As stated in the login command, the only sub-command that works without login is the sub-command show. All the others return an error message as shown below:
prosEO (no mission)> mission create
(E2802) User not logged in
prosEO (no mission)> mission update
(E2802) User not logged in
prosEO (no mission)> mission spacecraft
(E2802) User not logged in
prosEO (no mission)> mission show
---
- id: 82
version: 1
(...)
The sub-command mission show is giving the ability to the user to see
- all the existing missions in the prosEO platform or
- if providing a specific mission code to see information for that specific mission only
The user has the option to see the information in 3 different formats, JSON/XML/YAML.
In the example below we see the user using the sub-command to retrieve all the existing missions in the prosEO platform. Since the list may be long, the example is a simulated one:
prosEO (NM4T)> mission show
---
- id: 8200
version: 1
code: "TM"
(...)
- id: 8201
version: 1
code: "TM2"
(...)
In the example below we see the user using the sub-command to see information only for the mission NM4T:
prosEO (NM4T)> mission show NM4T
---
id: 8061
version: 4
code: "NM4T"
name: "New Mission for Testing"
(...)
As mentioned earlier, the default output format is YAML. The examples below show the output in XML and JSON
prosEO (NM4T)> mission show --format=XML NM4T
<?xml version='1.1' encoding='UTF-8'?>
<RestMission>
<id>8061</id>
<version>4</version>
<code>NM4T</code>
<name>New Mission for Testing</name>
(...)
prosEO (NM4T)> mission show --format=JSON NM4T
{
"id" : 8061,
"version" : 4,
"code" : "NM4T",
"name" : "New Mission for Testing",
(...)
In case the user is trying to show a mission that does not exist, the system returns an error message as shown below:
prosEO (NM4T)> mission show testest
(E2825) Mission testest not found
The sub-commands gives the ability to the user to create a new Earth Observation mission. As an EO mission requires several pieces of information, the users have 2 options: a) use the CLI interactively in order to add all the necessary information b) inject the information via an external file
In case the user chooses to create the mission interactively, the user is required to provide initial information via the command line interface, based on prompts that the system returns. After the initial required information is provided and the mission is created, the user can use the sub-command [mission] update in order to add information in the mission definition.
In case the user chooses to inject the information via an external file, the user should inject a .json file. An example of the mission definition is given here:
to be written
In order to use the sub-command [mission] create, the user must have administration privileges in order to create a new mission and a user account associated to the new mission. After the admin account creates the mission and user account, the users can login to the newly created mission with the new user account.
The following example shows the creation of a mission, interactively via the CLI. As per the below example, the user is prompted to enter 2 pieces of information:
- The Mission Name, which represents a more descriptive name of the Mission's Code
- A filename template for the Mission's products. In the example below, the template follows the Spring Expression Language format. For more information, please refer to the Data Model of prosEO.
prosEO (PTM)> mission create NM4T
Checking for missing mandatory attributes ...
Mission name (empty field cancels): New Mission for Testing
Product file name template (empty field cancels): NM4T_${fileClass}_${productClass.productType}_${T(java.time.format.DateTimeFormatter).ofPattern("uuuuMMdd'T'HHmmss").withZone(T(java.time.ZoneId).of("UTC")).format(sensingStartTime)}_${T(java.time.format.DateTimeFormatter).ofPattern("uuuuMMdd'T'HHmmss").withZone(T(java.time.ZoneId).of("UTC")).format(sensingStopTime)}_${(new java.text.DecimalFormat("00000")).format(null == orbit ? 0 : orbit.orbitNumber)}_${parameters.get("copernicusCollection").getParameterValue()}_${configuredProcessor.processor.processorVersion.replaceAll("\\.", "")}_${T(java.time.format.DateTimeFormatter).ofPattern("uuuuMMdd'T'HHmmss").withZone(T(java.time.ZoneId).of("UTC")).format(generationTime)}.nc
(I2859) Mission NM4T created (database ID 8061)
The 2 information that the CLI requests, are the 2 basic information for the creation of a mission. If the user chooses the command "mission show", the user will see that some attributes are for the moment empty. Refer to the Data Model for the full list of attributes that are required for the configuration of a mission and to the Wiki Section "How to create a mission" for more information.
Note: the system does not allow the creation of a mission without a mission code
The command gives the ability to the user to update the configuration/definition of the mission in which the user is logged in. The user cannot update an external mission.
There are 2 options for the user:
- The user is able to target a specific attribute that is intended to be updated.
- Alternatively, the user can inject an external file with the new version of the mission configuration/definition
Note: In case the users choose to update a mission via the CLI, they cannot update the attribute spacecrafts. There is a specific sub-command for that which is allowing the addition or removal of spacecraft for the mission. On the other hand, the users can inject a new mission configuration/definition via an external file where they can include the most up-to-date list of spacecraft for the mission.
In the example below, we see the user changing the descriptive name of the mission:
prosEO (NM4T)> mission update name=ABC
(I2843) Mission 8061 updated (new version 5)
prosEO (NM4T)> mission show NM4T
---
id: 8061
version: 5
code: "NM4T"
name: "ABC"
In case the user wishes to add a descriptive name with multiple words, the user might come across the following errors:
prosEO (NM4T)> mission update name=Test Mission
(E2915) Parameter of format '<attribute name>=<attribute value>' expected at position 1 for command update
prosEO (NM4T)>
(...)
prosEO (NM4T)> mission update name="Test Mission"
(E2919) Parameter of type string expected at position 0 for command update
The above errors show to the user that a specific syntax must be followed. The example below shows that the correct syntax requires the use of double quotes for the whole attribute, as per the help page:
prosEO (NM4T)> mission update "name=New Mission for Testing"
(I2843) Mission 8061 updated (new version 7)
prosEO (NM4T)> mission show NM4T
---
id: 8061
version: 7
code: "NM4T"
name: "New Mission for Testing"
to be written
The sub-command spacecraft gives the ability to the users to add or remove spacecraft from the mission they are logged in.
The users have the option to either add/remove a spacecraft via the CLI or simply inject an external file with the updated information for the attribute. In order to add/remove a spacecraft, the users have to invoke a spacecraft code. Please refer to the Data Model for more information.
In the example below we see the user adding and removing a spacecraft interactively:
prosEO (NM4T)> mission spacecraft add NM4T_Spacecraft_Test
Checking for missing mandatory attributes ...
Spacecraft name (empty field cancels): NM4T Spacecraft Test
(I2846) Spacecraft NM4T_Spacecraft_Test added (database ID 9369)
(...)
prosEO (NM4T)> mission spacecraft remove NM4T_Spacecraft_Test
(I2847) Spacecraft NM4T_Spacecraft_Test removed from mission NM4T
In case the users do not add an intended spacecraft code, the system requests this information:
prosEO (NM4T)> mission spacecraft add
Checking for missing mandatory attributes ...
Spacecraft code (empty field cancels): test
Spacecraft name (empty field cancels): test
(I2846) Spacecraft test added (database ID 9371)