Functions

diet-bmms-lib.h File Reference

This file can be used to access the API for the DIET Batch Management Multi-jobs System. More...

#include <sys/types.h>

Go to the source code of this file.

Functions

char * dietSubmitLot (const char *path_to_lot, char **errorMessage, char **hostname)
 Function used to submit a lot (a set of jobs) on a machine.
char * dietBuildLot (const char *hostname, int nbIDs, const char *const *listIDs, char **errorMessage)
 Function used to build a lot (a set of jobs) with given ids on a machine.
char * dietListLot (const char *hostname)
 Function used to get the information of all lots on a machine.
char * dietStatusLot (const char *hostname, const char *ID)
 Function used to get the status of a lot (a set of jobs) on a machine.
char * dietCancelLot (const char *hostname, const char *ID)
 Function used to cancel a lot (a set of jobs) of a given id on a machine.
char * dietGetOutPutLot (const char *hostname, const char *ID, char **output, char **error, char **output_path, char **error_path)
 Function used to get the output of a lot (a set of jobs) on a machine.

Detailed Description

This file can be used to access the API for the DIET Batch Management Multi-jobs System.


Function Documentation

char* dietBuildLot ( const char *  hostname,
int  nbIDs,
const char *const *  listIDs,
char **  errorMessage 
)

Function used to build a lot (a set of jobs) with given ids on a machine.

Parameters:
hostnamename of the machine
numberof IDs
listIDsthe list of ids that you want to build a lot with
errorMessageerror message
Returns:
the ID of the lot

Here is a example code using the dietBuildLot function to create a lot out of a list of job IDs on a given machine.

 #include <stdio.h>
 #include <stdlib.h>
 #include "JobStructures.h"
 #include "diet-bmms-lib.h"
 
 int main(int argc, char* argv[]){
 
   diet_initialize(argv[1], argc, argv);

   char **listIDs = (char**) malloc(sizeof(char*) * (argc - 3));
   for(int i=3; i < argc; i++) 
     listIDs[i] = argv[i];

   char *errorMessage = NULL;
   char *lotID = NULL;
   lotID = dietBuildLot("fen", listIDs, &errorMessage);

   if(strlen(job_id)!=0)
     printf("Lot ID: %s\n", lotID);
   else
     printf("Error: %s\n", errorMessage);
 
   free(errorMessage);
   free(lotID);
   free(listIDs);
   diet_finalize();
 }
char* dietCancelLot ( const char *  hostname,
const char *  ID 
)

Function used to cancel a lot (a set of jobs) of a given id on a machine.

Parameters:
hostnamename of the machine
IDidentifiant of the lot or job
Returns:
execution message

Here is a example code using the dietCancelLot function to cancel a lot on a given machine.

 #include <stdio.h>
 #include <stdlib.h>
 #include "JobStructures.h"
 #include "diet-bmms-lib.h"
 
 int main(int argc, char* argv[]){
 
   diet_initialize(argv[1], argc, argv);

   char *ID = argv[2];
   char *message = NULL;

   message = dietCancelLot("fen", ID);

   printf("%s\n", message);
   free(message);
   diet_finalize();
 }
char* dietGetOutPutLot ( const char *  hostname,
const char *  ID,
char **  output,
char **  error,
char **  output_path,
char **  error_path 
)

Function used to get the output of a lot (a set of jobs) on a machine.

Parameters:
hostnamename of the machine
IDidentifiant of the lot or job
outputthe output information
errorthe error information
output_paththe output path specified in the script
error_paththe error path specified in the script
Returns:
execution message

Here is a example code using the dietGetOutputLot function to retreive the the lot stdout and stderr of a job.

 #include <stdio.h>
 #include <stdlib.h>
 #include "JobStructures.h"
 #include "diet-bmms-lib.h"
 
 int main(int argc, char* argv[]){
 
   diet_initialize(argv[1], argc, argv);

   char *ID = argv[2];
   char *output = NULL;
   char *error = NULL;
   char *output_path = NULL;
   char *error_path = NULL;
   char *cmd_output = NULL; 
   cmd_output = dietGetOutputLot("fen", ID, &output, &error,
                                 &output_path, &error_path);

   printf("The output of the job id %s is: %s\n", ID, output); 
   printf("The output path of the job id %s is: %s\n", ID, output_path);
   printf("The error of the job id %s is: %s\n", ID, error);
   printf("The error path of the job id %s is: %s\n", ID, error_path);
   printf("Execution message is: %s\n", cmd_output);
   free(output);
   free(error);
   free(output_path);
   free(error_path);
   free(cmd_output);
   diet_finalize();
 }
char* dietListLot ( const char *  hostname )

Function used to get the information of all lots on a machine.

Parameters:
hostnamename of the machine
Returns:
the listing informations

Here is a example code using the dietListLot function to list all lots present on a given machine.

 #include <stdio.h>
 #include <stdlib.h>
 #include "JobStructures.h"
 #include "diet-bmms-lib.h"
 
 int main(int argc, char* argv[]){
 
   diet_initialize(argv[1], argc, argv);
   char * listInfo = dietListLot("fen");

   printf("Info: %s\n", listInfo);
   free(listInfo);
   diet_finalize();
 }
char* dietStatusLot ( const char *  hostname,
const char *  ID 
)

Function used to get the status of a lot (a set of jobs) on a machine.

Parameters:
hostnamename of the machine
IDidentifiant of the lot or job
Returns:
the status informations

Here is a example code using the dietStatusLot function to get the status of a lot on a given machine.

 #include <stdio.h>
 #include <stdlib.h>
 #include "JobStructures.h"
 #include "diet-bmms-lib.h"
 
 int main(int argc, char* argv[]){
 
   diet_initialize(argv[1], argc, argv);

   char *ID = argv[2];
   char *status = NULL;

   status = dietStatusLot("fen", ID);
 
   printf("Status: %s\n", status);
   free(status);
   diet_finalize();
 }
char* dietSubmitLot ( const char *  path_to_lot,
char **  errorMessage,
char **  hostname 
)

Function used to submit a lot (a set of jobs) on a machine.

Parameters:
path_to_lotthe path to get the lot file or script file
errorMessageerror message
hostnamethe host on which the job has been submitted
Returns:
the ID of the lot

Here is a example code using the dietSubmitLot function to submit the lot on a best selected machine.

 #include <stdio.h>
 #include <stdlib.h>
 #include "JobStructures.h"
 #include "diet-bmms-lib.h"
 
 int main(int argc, char* argv[]){
 
   diet_initialize(argv[1], argc, argv);

   char *my_lot = argv[2];
   char *errorMessage = NULL;
   char *hostname = NULL;
   char *lotID = NULL;

   lotID = dietSubmitLot(my_lot, &errorMessage, &hostname);

   if(strlen(job_id)!= 0 && strlen(hostname) != 0)
     printf("Lot submitted on %s, with ID: %s\n", hostname, lotID);
   else
     printf("Error: %s\n", errorMessage);
 
   free(errorMessage);
   free(hostname);
   free(lotID);
   diet_finalize();
 }
 All Classes Files Functions Variables