GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

resourcebroker.c File Reference

Source file for the sample ResourceBroker CPI provider. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/utsname.h>
#include "GATCPI.h"
#include "GATResourceCPIInstanceData.h"
#include "GATJobCPIInstanceData.h"
#include "resourcebroker.h"

Include dependency graph for resourcebroker.c:

Include dependency graph

Go to the source code of this file.

Functions

void resourcebroker_adaptor_ResourceBrokerCPI_Destroy (void *data)
GATResult resourcebroker_adaptor_GATResourceBrokerCPI_ServiceActions (void *data, GATResourceBrokerCPI_Instance *instance_data, GATTimePeriod_const timeout)
 resourcebroker_adaptor_GATResourceBrokerCPI_ServiceActions

GATResult resourcebroker_adaptor_GATResourceBrokerCPI_CreateInstance (void *data, GATResourceBrokerCPI_Instance *instance_data)
 resourcebroker_adaptor_GATResourceBrokerCPI_CreateInstance Create a new CPI object instance.

void resourcebroker_adaptor_GATResourceBrokerCPI_DestroyInstance (void *data, GATResourceBrokerCPI_Instance *instance_data)
 resourcebroker_adaptor_GATResourceBrokerCPI_DestroyInstance Destroy a CPI object instance.

GATResult resourcebroker_adaptor_GATResourceBrokerCPI_CloneInstance (void *data, GATResourceBrokerCPI_Instance const *instance_data, GATResourceBrokerCPI_Instance *new_instance_data)
 resourcebroker_adaptor_GATResourceBrokerCPI_CloneInstance Clone a CPI object instance.

GATResult resourcebroker_adaptor_GATResourceBrokerCPI_EqualsInstance (void *data, GATResourceBrokerCPI_Instance const *lhs, GATResourceBrokerCPI_Instance const *rhs, GATBool *isequal)
 resourcebroker_adaptor_GATResourceBrokerCPI_EqualsInstance Clone a CPI object instance.

GATResult resourcebroker_adaptor_ResourceBrokerCPI_ReserveResource_Description (void *data, GATResourceBrokerCPI_Instance const *instance_data, GATResourceDescription_const description, GATTime_const time, GATTimePeriod_const duration, GATReservation *reservation)
GATResult resourcebroker_adaptor_ResourceBrokerCPI_ReserveResource (void *data, GATResourceBrokerCPI_Instance const *instance_data, GATResource_const resource, GATTime_const time, GATTimePeriod_const duration, GATReservation *reservation)
GATResult resourcebroker_adaptor_ResourceBrokerCPI_FindResources (void *data, GATResourceBrokerCPI_Instance const *instance_data, GATResourceDescription_const description, GATList_GATResource *resources)
 resourcebroker_adaptor_ResourceBrokerCPI_FindResources Find a list of matching resources.

GATResult resourcebroker_adaptor_ResourceBrokerCPI_SubmitJob (void *data, GATResourceBrokerCPI_Instance const *instance_data, GATJobDescription_const desription, GATJob *job)
 resourcebroker_adaptor_ResourceBrokerCPI_SubmitJob

GATResult resourcebroker_adaptor_SubmitJob (GATContext context, GATString_const vo_name, GATResource_const resource, GATJobDescription_const jd, GATJob *job)
GATResult resourcebroker_adaptor_Register_GATResourceBrokerCPI (GATContext error_context, GATRegistry registry, GATTable_const system_config, GATTable_const instance_config, void *token)
GATResult resourcebroker_adaptor_CreateResource (GATContext context, GATResourceDescription rd, GATResource *resource)
 resourcebroker_adaptor_CreateResource

GATResult resourcebroker_adaptor_MyPreferences (GATContext context, GATPreferences *prefs)
 resourcebroker_adaptor_MyPreferences

GATResult resourcebroker_adaptor_make_sample_jobid (GATString_const vo_name, GATString *new_job_id)
GATResourceDescription resourcebroker_adaptor_CreateHardwareResourceDescription (void)

Variables

const char * rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/adaptors/resourcebroker/resourcebroker.c,v 1.15 2004/04/26 15:45:00 hartmutkaiser Exp $"


Detailed Description

Source file for the sample ResourceBroker CPI provider.

Date:
Thu Oct 23 2003
Version:
Header:
/export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/adaptors/resourcebroker/resourcebroker.c,v 1.15 2004/04/26 15:45:00 hartmutkaiser Exp

Copyright (C) Hartmut Kaiser This file is part of the GAT Engine. Contributed by Hartmut Kaiser <hartmutkaiser [at] t-online [dot] de>.

Use, modification and distribution is subject to the Gridlab Software License. (See accompanying file GLlicense.txt or copy at http://www.gridlab.org/GLlicense.txt)

Definition in file resourcebroker.c.


Function Documentation

void resourcebroker_adaptor_ResourceBrokerCPI_Destroy void *    data [static]
 

Definition at line 167 of file resourcebroker.c.

References data.

Referenced by resourcebroker_adaptor_Register_GATResourceBrokerCPI().

GATResult resourcebroker_adaptor_GATResourceBrokerCPI_ServiceActions void *    data,
GATResourceBrokerCPI_Instance   instance_data,
GATTimePeriod_const    timeout
[static]
 

resourcebroker_adaptor_GATResourceBrokerCPI_ServiceActions

The function resourcebroker_adaptor_GATResourceBrokerCPI_ServiceActions is called, whenever the client calls GATContext_ServiceActions. This function is called for every created object. This function should be used to update all instance specific data, which may have been changed asynchronously or to fire pending events.

Parameters:
data  Adaptor-provided data object.
instance_data  The instance data of this CPI object
timeout  This may be a 0 timeout to indicate no timeout at all, or a specific time length.
Returns:
An error code.

Definition at line 191 of file resourcebroker.c.

References data, GAT_NOTIMPL, and GATTimePeriod_const.

Referenced by resourcebroker_adaptor_Register_GATResourceBrokerCPI().

GATResult resourcebroker_adaptor_GATResourceBrokerCPI_CreateInstance void *    data,
GATResourceBrokerCPI_Instance   new_instance_data
[static]
 

resourcebroker_adaptor_GATResourceBrokerCPI_CreateInstance Create a new CPI object instance.

Adaptor implementation of create instance capability.

Parameters:
data  Adaptor-provided data object.
context  The GATContext for this CPI instance
target  The location of the file in question.
new_instance_data  The pointer to the variable, where the instance data of this CPI object is to be returned to.
Returns:
An error code.

Definition at line 210 of file resourcebroker.c.

References data, GAT_INVALID_PARAMETER, GAT_SUCCESS, GATResult, and GATResourceBrokerCPI_Instance::instance_data.

Referenced by resourcebroker_adaptor_Register_GATResourceBrokerCPI().

void resourcebroker_adaptor_GATResourceBrokerCPI_DestroyInstance void *    data,
GATResourceBrokerCPI_Instance   instance_data
[static]
 

resourcebroker_adaptor_GATResourceBrokerCPI_DestroyInstance Destroy a CPI object instance.

Adaptor implementation of destroy instance capability.

Parameters:
data  Adaptor-provided data object.
instance_data  The instance data of the CPI object to destroy.

Definition at line 230 of file resourcebroker.c.

References assert, data, and GATResourceBrokerCPI_Instance::instance_data.

Referenced by resourcebroker_adaptor_Register_GATResourceBrokerCPI().

GATResult resourcebroker_adaptor_GATResourceBrokerCPI_CloneInstance void *    data,
GATResourceBrokerCPI_Instance const *    instance_data,
GATResourceBrokerCPI_Instance   new_instance_data
[static]
 

resourcebroker_adaptor_GATResourceBrokerCPI_CloneInstance Clone a CPI object instance.

Adaptor implementation of the clone instance capability.

Parameters:
data  Adaptor-provided data object.
instance_data  The instance data of this CPI object
new_instance_data  The pointer to the variable, where the instance data of the cloned CPI object is to be returned to.
Returns:
An error code.

Definition at line 248 of file resourcebroker.c.

References data, GAT_SUCCESS, and GATResourceBrokerCPI_Instance::instance_data.

Referenced by resourcebroker_adaptor_Register_GATResourceBrokerCPI().

GATResult resourcebroker_adaptor_GATResourceBrokerCPI_EqualsInstance void *    data,
GATResourceBrokerCPI_Instance const *    lhs,
GATResourceBrokerCPI_Instance const *    rhs,
GATBool   isequal
[static]
 

resourcebroker_adaptor_GATResourceBrokerCPI_EqualsInstance Clone a CPI object instance.

Adaptor implementation of the clone instance capability.

Parameters:
data  Adaptor-provided data object.
lhs  The instance data of the left CPI object.
lhs  The instance data of the right CPI object.
isequal  The pointer to the variable, where the result is to be returned to.
Returns:
An error code.

Definition at line 272 of file resourcebroker.c.

References data, GAT_INVALID_PARAMETER, GAT_SUCCESS, GATBool, GATResult, and GATTrue.

Referenced by resourcebroker_adaptor_Register_GATResourceBrokerCPI().

GATResult resourcebroker_adaptor_ResourceBrokerCPI_ReserveResource_Description void *    data,
GATResourceBrokerCPI_Instance const *    instance_data,
GATResourceDescription_const    description,
GATTime_const    time,
GATTimePeriod_const    duration,
GATReservation   reservation
[static]
 

Definition at line 288 of file resourcebroker.c.

References data, GAT_NOTIMPL, GATReservation, GATResourceDescription_const, GATResult, GATTime_const, and GATTimePeriod_const.

Referenced by resourcebroker_adaptor_Register_GATResourceBrokerCPI().

GATResult resourcebroker_adaptor_ResourceBrokerCPI_ReserveResource void *    data,
GATResourceBrokerCPI_Instance const *    instance_data,
GATResource_const    resource,
GATTime_const    time,
GATTimePeriod_const    duration,
GATReservation   reservation
[static]
 

Definition at line 298 of file resourcebroker.c.

References data, GAT_NOTIMPL, GATReservation, GATResource_const, GATResult, GATTime_const, and GATTimePeriod_const.

Referenced by resourcebroker_adaptor_Register_GATResourceBrokerCPI().

GATResult resourcebroker_adaptor_ResourceBrokerCPI_FindResources void *    adaptor_data,
GATResourceBrokerCPI_Instance const *    instance_data,
GATResourceDescription_const    description,
GATList_GATResource *    resources
[static]
 

resourcebroker_adaptor_ResourceBrokerCPI_FindResources Find a list of matching resources.

The function resourcebroker_adaptor_ResourceBrokerCPI_FindResources should try to find all resources matching the given description and it should return the found resources as a list.

Parameters:
adaptor_data  Adaptor-provided data object.
instance_data  The instance data of this CPI object
description  The description to match while searching for resources.
resources  The pointer to a variable receiving the resulting list of matching resources.
Returns:
An error value.

Definition at line 323 of file resourcebroker.c.

References GATResourceBrokerCPI_Instance::context, GAT_CREATE_STATUS, GAT_CREATE_STATUS_IF, GAT_CURRENT_STATUS, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_NO_MATCHING_RESOURCE, GAT_RETURN_STATUS, GAT_SUCCESS, GAT_USES_STATUS, GATBool, GATFalse, GATObject_Destroy(), GATResourceDescription, GATResourceDescription_const, GATResourceDescription_Destroy(), GATResourceDescription_Equals(), resourcebroker_adaptor_CreateHardwareResourceDescription(), and resourcebroker_adaptor_CreateResource().

Referenced by resourcebroker_adaptor_Register_GATResourceBrokerCPI(), and resourcebroker_adaptor_ResourceBrokerCPI_SubmitJob().

GATResult resourcebroker_adaptor_ResourceBrokerCPI_SubmitJob void *    adaptor_data,
GATResourceBrokerCPI_Instance const *    instance_data,
GATJobDescription_const    jd,
GATJob   job
[static]
 

resourcebroker_adaptor_ResourceBrokerCPI_SubmitJob

The function resourcebroker_adaptor_ResourceBrokerCPI_SubmitJob should submit a new job to the resource described by the given job description.

Parameters:
adaptor_data  Adaptor-provided data object.
instance_data  The instance data of this CPI object
description  The job description containing the information about the job iteslf and the resource to use.
job  The pointer to a variable receiving the resulting GATJob object handle.
Returns:
An error value.

Definition at line 405 of file resourcebroker.c.

References GATResourceBrokerCPI_Instance::context, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_NO_MATCHING_RESOURCE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_USES_STATUS, GATJob, GATJobDescription_const, GATJobDescription_GetResource(), GATJobDescription_GetResourceDescription(), GATResource_const, GATResourceDescription_const, resourcebroker_adaptor_ResourceBrokerCPI_FindResources(), resourcebroker_adaptor_SubmitJob(), and GATResourceBrokerCPI_Instance::vo_name.

Referenced by resourcebroker_adaptor_Register_GATResourceBrokerCPI().

GATResult resourcebroker_adaptor_SubmitJob GATContext    context,
GATString_const    vo_name,
GATResource_const    resource,
GATJobDescription_const    jd,
GATJob   job
[static]
 

Definition at line 541 of file resourcebroker.c.

References GAT_CREATE_STATUS, GAT_CREATE_STATUS_IF, GAT_CURRENT_STATUS, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_USES_STATUS, GATFalse, GATJob, GATJob_Create(), GATJobCPIInstance_Data_Create(), GATJobCPIInstance_Data_Destroy(), GATJobDescription_const, GATPreferences_Destroy(), GATResource_const, GATResource_GetResourceDescription(), GATResourceDescription_const, GATResourceDescription_GetType(), GATString_const, GATString_Destroy(), GATTable_const, GATTable_Get_String(), GATType_GATHardwareResourceDescription, resourcebroker_adaptor_make_sample_jobid(), and resourcebroker_adaptor_MyPreferences().

Referenced by resourcebroker_adaptor_ResourceBrokerCPI_SubmitJob().

GATResult resourcebroker_adaptor_Register_GATResourceBrokerCPI GATContext    error_context,
GATRegistry    registry,
GATTable_const    system_config,
GATTable_const    instance_config,
void *    token
 

Definition at line 98 of file resourcebroker.c.

References GATResourceBrokerCPI_Data::clone_instance, cpi, GATResourceBrokerCPI_Data::create_instance, GATResourceBrokerCPI_Data::data, GATResourceBrokerCPI_Data::destroy, GATResourceBrokerCPI_Data::destroy_instance, GATResourceBrokerCPI_Data::equals_instance, GATResourceBrokerCPI_Data::find_resources, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAILED, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_USES_STATUS, GATPreferences_Add(), GATPreferences_Create(), GATPreferences_Destroy(), GATResourceBrokerCPI_Create(), GATResourceBrokerCPI_Destroy(), GATRESOURCEBROKERCPI_VERSION, GATResult, GATTable_const, GATResourceBrokerCPI_Data::reserve, GATResourceBrokerCPI_Data::reserve_description, resourcebroker_adaptor_GATResourceBrokerCPI_CloneInstance(), resourcebroker_adaptor_GATResourceBrokerCPI_CreateInstance(), resourcebroker_adaptor_GATResourceBrokerCPI_DestroyInstance(), resourcebroker_adaptor_GATResourceBrokerCPI_EqualsInstance(), resourcebroker_adaptor_GATResourceBrokerCPI_ServiceActions(), resourcebroker_adaptor_ResourceBrokerCPI_Destroy(), resourcebroker_adaptor_ResourceBrokerCPI_FindResources(), resourcebroker_adaptor_ResourceBrokerCPI_ReserveResource(), resourcebroker_adaptor_ResourceBrokerCPI_ReserveResource_Description(), resourcebroker_adaptor_ResourceBrokerCPI_SubmitJob(), GATResourceBrokerCPI_Data::service_actions, GATResourceBrokerCPI_Data::submit_job, and token.

Referenced by resourcebroker_adaptor_register().

GATResult resourcebroker_adaptor_CreateResource GATContext    context,
GATResourceDescription    rd,
GATResource   resource
 

resourcebroker_adaptor_CreateResource

The function resourcebroker_adaptor_CreateResource creates a new GATResource for the given resource description (which should match the local hardware).

Parameters:
context  The GATContext to use for creation of the GATResource.
rd  The resource description matching the local hardware.
resource  The pointer to the variable, which receives the resulting GATResource.
Returns:
An error code.

Definition at line 496 of file resourcebroker.c.

References GAT_CREATE_STATUS, GAT_CREATE_STATUS_IF, GAT_CURRENT_STATUS, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_USES_STATUS, GATHardwareResource, GATPreferences_Destroy(), GATResourceCPIInstance_Data_Create(), GATResourceCPIInstance_Data_Destroy(), GATResourceDescription, and resourcebroker_adaptor_MyPreferences().

Referenced by resourcebroker_adaptor_GATSelfCPI_create_self_resource(), and resourcebroker_adaptor_ResourceBrokerCPI_FindResources().

GATResult resourcebroker_adaptor_MyPreferences GATContext    context,
GATPreferences   prefs
 

resourcebroker_adaptor_MyPreferences

Definition at line 621 of file resourcebroker.c.

References GAT_CREATE_STATUS, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_USES_STATUS, GATPreferences_Add(), and GATPreferences_Create().

Referenced by resourcebroker_adaptor_CreateResource(), resourcebroker_adaptor_GATSelfCPI_CreateRequestForListener(), resourcebroker_adaptor_GATSelfCPI_GetJob(), and resourcebroker_adaptor_SubmitJob().

GATResult resourcebroker_adaptor_make_sample_jobid GATString_const    vo_name,
GATString   new_job_id
 

Definition at line 651 of file resourcebroker.c.

References GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_SUCCEEDED, GATResult, GATString_Concatenate(), GATString_const, GATString_Create(), GATString_Destroy(), and GATuint32.

Referenced by resourcebroker_adaptor_GATSelfCPI_GetJob(), and resourcebroker_adaptor_SubmitJob().

GATResourceDescription resourcebroker_adaptor_CreateHardwareResourceDescription void   
 

Definition at line 712 of file resourcebroker.c.

References assert, GATTable_Add_float(), GATTable_Add_String(), GATTable_Create(), and GATTable_Destroy().

Referenced by resourcebroker_adaptor_GATSelfCPI_create_self_jobdescription(), resourcebroker_adaptor_GATSelfCPI_create_self_resource(), and resourcebroker_adaptor_ResourceBrokerCPI_FindResources().


Variable Documentation

const char* rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/adaptors/resourcebroker/resourcebroker.c,v 1.15 2004/04/26 15:45:00 hartmutkaiser Exp $" [static]
 

Definition at line 17 of file resourcebroker.c.