Difference between revisions of "Resource Manager"

From Gcube Wiki
Jump to: navigation, search
(Interface)
Line 45: Line 45:
  
 
==== Interface  ====
 
==== Interface  ====
The service exposes a single <code>ResourceManager</code> portType ...
 
  
 +
===== Operations =====
 +
The service exposes a single <code>ResourceManager</code> portType ...
  
 +
''[TBC]''
  
  

Revision as of 00:44, 20 March 2010

The ResourceManager service is in charge of managing gCube Scope contexts. An instance (and only one) of the service must be deployed for each scope (at any level, i.e. infrastructure, VO, VRE) in order to handle gCube Resources within the assigned scope. It manages requests of adding and removing gCube Resource from the assigned Scope by keeping, at the same time, a consistent state in the whole infrastructure. A Scope Resource is published in the Information System with constantly updated information about the current composition of the Scope.

Design

Service architecture and code design

The service implements a singleton WSRF pattern. This means that there is a single stateful resource holding the state of the managed Scope.

The following class diagram shows a simplified view of the organization and structure of the Resource Manager's source code.

Figure 1. Resource Manager Class Diagram

[TBD]

Concept, role and design of ScopedResource

A Resource Manager instance handles the Scope it is managing as a set of Scoped Resources. A Scoped Resource models a gCube Resource in a specific Scope. At the heart of the Scope management activities there is the management of the state of the Scoped Resources belonging the Scope.

The following diagram depicts the possible Scope Resource's statuses and the legal transitions among them. The starting point of the life of a Scope Resource is always the request to join an existing gCube Resource to the Scope.


Figure 2. Scoped Resource - life cycle

The crucial statuses are ADDED and REMOVED, where the concrete (and resource specific) actions to join the gCube Resource to the Scope are performed. For instance, in case of a Service Resource, a new instance of the service is deployed when managing the ADDED status, while undeployment is performed in the REMOVED status.

[TBC]


Scope state
  • Scope state management versus old VRE state management
  • Raw state separated from the state behavior to avoid mis-serializations due to any future change in the service implementation
  • Local XStream serialization
  • Synchronization between local and remote (i.e. stored in the IS) state and vice versa
  • ...

[TBC]

Observer pattern strategy

The service adopts an observer pattern-based internal strategy for managing the scope state. Each time the state of any Scoped Resource changes, registered observers are properly notified in order to manage the new state.

[TBC]

Interface

Operations

The service exposes a single ResourceManager portType ...

[TBC]


Resource Report

After each resource management request, a report is produced and disseminated (via the getReport operation). The basic structure of the report is:

<ResourceReport>
  <ID><!--report ID --></ID>
  <LastUpdate><!--last update time --></LastUpdate>
  <TargetScope><!-- target scope of the operations reported in the following section --></TargetScope>
  <Resources>
     <!-- list of gCube resources involved and their actual status-->  
  </Resources>
  <Services>
   <!-- per each service involved in the request, a section like the following-->
    <Service>
 
     <!-- service data --> 
 
     <DependenciesResolution>
 
     <!-- information about service's dependencies (missed, resolved))-->
 
     </DependenciesResolution>
     <DeploymentActivity>
 
     <!-- information about deployment activities on the target gHN-->
 
     </DeploymentActivity>
    <Service>
  </Services>
</ResourceReport>

For each service, information about the service's dependencies resolution and package deployment are reported.

Possible dependencies statuses are:

  • SUCCESS: all the dependencies have been successfully resolved
  • FAILED: some dependencies are missing

Periodically, the Deployer service sends a report on the deployment activity (performed asynchronously with respect to the VREManager request). Such report has a status:

  • OPEN: the activity is still ongoing, other reports will follow
  • CLOSED : the activity is closed, no further report will be sent

Possible package statuses are:

  • WAITING: request is still pending
  • ALREADYDEPLOYED: the package was already available on the target gHN
  • SKIPPED: the package was not deployed due to an error in another service from which it depends on
  • FAILED: the deployment failed
  • DEPLOYED: the package has been deployed
  • NOTVERIFIED: the package has been deployed, but the correctness of the operation cannot be checked (and therefore guaranteed)
  • ACTIVATED: the package has been activated
  • RUNNING: the related instance is running

Possible resource statuses:

  • ADDED: the resource was successfully added to the scope
  • REMOVED: the resource was successfully removed to the scope
  • FAILED: an error occurred and the resource has not been managed

This is a sample report showing the results of a request including the add of a service, a generic resource, a collection and an existing running instance to the managed scope:

<?xml version="1.0" encoding="UTF-8"?>
<ResourceReport>
  <ID>4522f7c0-a54c-11dd-8525-e7e836b0fdde</ID>
  <LastUpdate>2008-10-29T00:58:17+01:00</LastUpdate>
  <TargetScope>/gcube/devsec</TargetScope>
  <Resources>
    <Resource>
      <ID>83080450-a235-11dd-8a29-b025e02401d5</ID>
      <Type>RunningInstance</Type>
      <Status>ADDED</Status>
      <ErrorDescription>-</ErrorDescription>
    </Resource>
    <Resource>
      <ID>61927680-a996-11dd-961c-8eba14a244c3</ID>
      <Type>MetadataCollection</Type>
      <Status>ADDED</Status>
      <ErrorDescription>-</ErrorDescription>
    </Resource>
    <Resource>
      <ID>f2c04460-b446-11dd-8aab-e7a1e3fdae89</ID>
      <Type>GenericResource</Type>
      <Status>ADDED</Status>
      <ErrorDescription>-</ErrorDescription>
    </Resource>
  </Resources>
  <Services>
    <Service>
      <ID>83080450-a235-11dd-8a29-b025e0249999</ID>
      <Class>InformationSystem</Class>
      <Name>IS-Notifier</Name>
      <Version>1.00.00</Version>
      <DependenciesResolutionStatus>SUCCESS</DependenciesResolutionStatus>
      <DeployedOn>9bf172d0-a30c-11dd-88bf-83f7edc13611</DeployedOn>
      <ErrorDescription>-</ErrorDescription>
      <DependenciesResolution>
        <ResolvedDependencies>
          <Dependency>
            <ServiceClass>InformationSystem</ServiceClass>
            <ServiceName>IS-Notifier</ServiceName>
            <ServiceVersion>1.00.00</ServiceVersion>
            <PackageName>Notifier-service</PackageName>
            <PackageVersion>1.01.00</PackageVersion>
          </Dependency>
          <Dependency>
            <ServiceClass>InformationSystem</ServiceClass>
            <ServiceName>IS-Notifier</ServiceName>
            <ServiceVersion>1.00.00</ServiceVersion>
            <PackageName>Notifier-stubs</PackageName>
            <PackageVersion>1.00.01</PackageVersion>
          </Dependency>
        </ResolvedDependencies>
        <MissingDependencies/>
      </DependenciesResolution>
      <DeploymentActivity>
        <GHN>
          <Host>dlib33.isti.cnr.it:8001</Host>
          <ID>9bf172d0-a30c-11dd-88bf-83f7edc13611</ID>
          <LastReportReceivedOn>2008-10-29T00:58:16+01:00</LastReportReceivedOn>
          <LastReportReceived>
            <Status>OPEN</Status>
            <Packages>
              <Package>
                <ServiceClass>InformationSystem</ServiceClass>
                <ServiceName>IS-Notifier</ServiceName>
                <ServiceVersion>1.00.00</ServiceVersion>
                <PackageName>Notifier-service</PackageName>
                <PackageVersion>1.01.00</PackageVersion>
                <Status>RUNNING</Status>
                <Message/>
              </Package>
              <Package>
                <ServiceClass>InformationSystem</ServiceClass>
                <ServiceName>IS-Notifier</ServiceName>
                <ServiceVersion>1.00.00</ServiceVersion>
                <PackageName>Notifier-stubs</PackageName>
                <PackageVersion>1.00.01</PackageVersion>
                <Status>ACTIVATED</Status>
                <Message/>
              </Package>
            </Packages>
          </LastReportReceived>
        </GHN>
      </DeploymentActivity>
    </Service>
  </Services>
</ResourceReport>


Scope Resource

The Scope Resource is a view on the current composition of the Scope context published in the IS. Each time the Scope is modified, the view is updated.

Here is an example of Scope Resource published in the IS:

<?xml version="1.0" encoding="UTF-8"?>
<Resource version="0.4.x">
  <ID>5c5de280-305e-11df-8c03-b428fe3276c2</ID>
  <Type>GenericResource</Type>
  <Scopes>
    <Scope>/gcube/devsec/CNR-VRE</Scope>
  </Scopes>
  <Profile>
    <SecondaryType>VRE</SecondaryType>
    <Name>CNR-VRE</Name>
    <Description/>
    <Body>
      <Scope>/gcube/devsec/CNR-VRE</Scope>
      <Service>http://cpe-66-65-101-30.nyc.res.rr.com:8080/wsrf/services/gcube/vremanagement/ResourceManager</Service>
      <Creator/>
      <Designer/>
      <StartTime>2010-03-15T16:52:22-04:00</StartTime>
      <SecurityEnabled>false</SecurityEnabled>
      <ScopedRescources>
        <ScopedRescource>
          <ResourceID>6e6e2ce0-1ca5-11df-a0fe-c8f6680864ab</ResourceID>
          <ResourceType>RunningInstance</ResourceType>
          <HostedOn>node13.d.d4science.research-infrastructures.eu:8080</HostedOn>
          <JointTime>2010-03-19T18:14:14-04:00</JointTime>
        </ScopedRescource>
        <ScopedRescource>
          <ResourceID>df899630-82ae-11de-a6cc-f15c9cf886be</ResourceID>
          <ResourceType>GenericResource</ResourceType>
          <JointTime>2010-03-19T18:14:16-04:00</JointTime>
        </ScopedRescource>
        <ScopedRescource>
          <ResourceID>a5db71f0-27aa-11df-8ee2-c1a4489ea34b</ResourceID>
          <ResourceType>MetadataCollection</ResourceType>
          <JointTime>2010-03-19T18:14:12-04:00</JointTime>
        </ScopedRescource>
        <ScopedRescource>
          <ResourceID>9ad3ce60-27aa-11df-9df7-e0bf8afcd20f</ResourceID>
          <ResourceType>Collection</ResourceType>
          <JointTime>2010-03-19T18:14:18-04:00</JointTime>
        </ScopedRescource>
      </ScopedRescources>
    </Body>
  </Profile>
</Resource>

gHNManager integration

...

Deployer integration

...

Resource Broker integration

...

Test-suite and sample usages

The Resource Manager comes with a test-suite package allowing to test its functionalities.The test-suite is completely independent and does not require any other gCube package, except than a local gCore installation. The package is composed by a set of classes, sample configuration files and scripts ready to be executed.


|-lib
|--org.gcube.vremanagement.resourcemanager.testsuite.jar
|
|-samples
|---...
|
|-addresource.sh
|-getreport.sh
|-changescopeoptions.sh
|-...

Each script allows to test a different service's operation or group of operations logically related. In the following, an explanation of each script and its usage is provided.

Add Resource(s)

The AddResources script invokes the AddResources operation to add new GCUBEResources on a scope. It must be executed as follows

./addresource.sh <ResourceManager host> <ResourceManager port> <configuration file>

Clearly, the Resource Manager host and port are the information needed to contact the Resource Manager instance, while the configuration file reports the information about the resources to add or create and the scope in which they have to be managed.

This is an example of configuration file requesting to add 4 gCube Resources to the Scope /gcube/devsec/CNR-VRE:

#global properties
 
numOfServicesToAdd=0
numOfResourcesToAdd=4
targetScope=/gcube/devsec/CNR-VRE
callerScope=/gcube/devsec/CNR-VRE
 
# resources' list
resource.1.id=9ad3ce60-27aa-11df-9df7-e0bf8afcd20f
resource.1.type=Collection
resource.2.id=6e6e2ce0-1ca5-11df-a0fe-c8f6680864ab
resource.2.type=RunningInstance
resource.3.id=a5db71f0-27aa-11df-8ee2-c1a4489ea34b
resource.3.type=MetadataCollection
resource.4.id=df899630-82ae-11de-a6cc-f15c9cf886be
resource.4.type=GenericResource

If everything works fine, the following report is produced (and it can retrieved via the getReport script):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ResourceReport>
  <ID>bdffb830-33a4-11df-97f6-8d3129726fea</ID>
  <LastUpdate>2010-03-19T18:14:10-04:00</LastUpdate>
  <TargetScope>/gcube/devsec/CNR-VRE</TargetScope>
  <Resources>
    <Resource>
      <ID>a5db71f0-27aa-11df-8ee2-c1a4489ea34b</ID>
      <Type>MetadataCollection</Type>
      <Status>ADDED</Status>
      <ErrorDescription>-</ErrorDescription>
    </Resource>
    <Resource>
      <ID>6e6e2ce0-1ca5-11df-a0fe-c8f6680864ab</ID>
      <Type>RunningInstance</Type>
      <Status>ADDED</Status>
      <ErrorDescription>-</ErrorDescription>
    </Resource>
    <Resource>
      <ID>df899630-82ae-11de-a6cc-f15c9cf886be</ID>
      <Type>GenericResource</Type>
      <Status>ADDED</Status>
      <ErrorDescription>-</ErrorDescription>
    </Resource>
    <Resource>
      <ID>9ad3ce60-27aa-11df-9df7-e0bf8afcd20f</ID>
      <Type>Collection</Type>
      <Status>ADDED</Status>
      <ErrorDescription>-</ErrorDescription>
    </Resource>
  </Resources>
  <Services/>
</ResourceReport>
Remove Resource(s)

[TBC]

Get Report

The GetReport script invokes the GetReport operation to retrieve a Resource Report. It must be executed as follows

./getreport.sh <ResourceManager host> <ResourceManager port> <caller scope> <report ID>

This request will print out the resource report related to the given report ID.