Service - Stage Manager

From Izara Wiki
Jump to navigation Jump to search

Overview

Each stage is handled by a Service - Stage (handlers) service.

The Stage Manager service handles shared orchestration of the Stage Handler services and the base stage objectType.

Repository

https://bitbucket.org/izara-supply-stages/izara-supply-stages-stage-manager

DynamoDB tables

StageRecord

Records which Handler manages each Stage

{
	stageId
	stageHandlerServiceNameTag
}
  • partition key: stageId
  • sort key: (none)

objectSchemas

{
	objectType: "stage",
    belongTo: { // maybe in future when add RBAC to eg stages can make adjustments a child of Stage or StageStandard, like DeliveryMethod RateTable
		serviceTag: "iii",
		objectType: "jjj"
	},
	storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
	},
	fieldNames: {
		stageId: {
			type: "string",
            randomOnCreate: true
		},
		timingSetting: {
			type: "string", // "immediate"|"fixed"|"variable"
		},
		fixedSeconds: {
			type: "numeric", // if timingSetting="fixed" this is the fixed number of seconds the stage takes
		},
		defaultSeconds: {
			type: "numeric", // if timingSetting="variable" this is the default number of seconds the stage takes
		}
	},
	identifiers: [
		{
			fieldName: "stageId"
		},
	]
},
{
	objectType: "stageChangeLocation",
    belongTo: { // maybe in future when add RBAC to eg stages
		serviceTag: "iii",
		objectType: "jjj"
	},
	storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
	},
	fieldNames: {
		stagechangeLocationId: {
			type: "string",
            randomOnCreate: true
		},
	},
	identifiers: [
		{
			fieldName: "stagechangeLocationId"
		},
	]
},
{
	objectType: "appliedStage",
	storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
	},
	fieldNames: {
		appliedStageId: {
			type: "string",
            randomOnCreate: true
		},
		fromTime: {
			type: "timestamp",
		},		
		toTime: {
			type: "timestamp",
		},		
	},
	identifiers: [
		{
			fieldName: "appliedStageId"
		},
	]
},
  • Created each time a stage is applied

relationshipSchemas

[
  {
    "hasAppliedStage": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "unitManager",
              objectType: "unit"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "stageManager",
              objectType: "appliedStage"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
[
  {
    "appliedStage": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "stageManager",
              objectType: "appliedStage"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "stageManager",
              objectType: "stage"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
[
  {
    "hasChangeLocation": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "stageManager",
              objectType: "stage"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "stageManager",
              objectType: "stageChangeLocation"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
  • links stage to a pair of from/to stageLocations
  • multiple pairs per stage allows for a stage to change the stageLocation according to the units current stageLocation
[
  {
    "changeFromLocation": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "stageManager",
              objectType: "stageChangeLocation"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "supplyLocationManager",
              objectType: "supplyLocation"
            },
            linkType: "one",
          }
        }
      ]
    }
  }
]
[
  {
    "changeToLocation": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "stageManager",
              objectType: "stageChangeLocation"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "supplyLocationManager",
              objectType: "supplyLocation"
            },
            linkType: "one",
          }
        }
      ]
    }
  }
]
  • When this stage is applied if the units location matches a stageChangeLocation's changeFromLocation, change to the changeToLocation
  • optional, if none set or none match, the stage does not change the unit's location
[
  {
    "hasMonitorMarker": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "stageManager",
              objectType: "stage"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "monitorManager",
              objectType: "monitorMarker"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
[
  {
    "disabledMonitorMarker": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "stageManager",
              objectType: "stage"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "monitorManager",
              objectType: "monitorMarker"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
  • During the period of the stage, this marker allows the monitor project to offer more granular monitoring, eg when feeding animals the feedAnimal stage could focus on a subset of the video feed group's feeds (eg the table where the feed is prepared)
  • A monitorMarker can be disabled and re-enabled
[
  {
    "appliedMonitorMarker": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "stageManager",
              objectType: "appliedStage"
            },
            linkType: "many",
          },
          to: {
            objType: {
              serviceTag: "monitorManager",
              objectType: "monitorMarker"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
  • Each time a stage is applied an appliedMonitorMarker relationship is created between the appliedStage object and all of the stage's active monitorMarkers
  • the monitorMarker then links to the monitor object that the market applies to

Working documents

Stage Manager