This file can be used to access the API for the DIET Batch Management System. More...
#include <sys/types.h>#include "JobStructures.h"Go to the source code of this file.
Functions | |
| int | dietlist (const char *hostname, listOfJobs_t *listOfJobs, char *errorMessage, const size_t errorSize) |
| Function used to list the jobs on a machine. | |
| int | dietNbJobs (const char *hostname, char *errorMessage, const size_t errorSize) |
| Function used to get the number of jobs on a machine. | |
| int | dietNbRunningJobs (const char *hostname, char *errorMessage, const size_t errorSize) |
| Function used to get the number of running jobs on a machine. | |
| int | dietNbWaitingJobs (const char *hostname, char *errorMessage, const size_t errorSize) |
| Function used to get the number of waiting jobs on a machine. | |
| int | dietcancel (const char *hostname, const char *jobId, char *outputMessage, const size_t maxsize, char *errorMessage, const size_t errorSize) |
| Function used to cancel a job on a machine with its job id. | |
| int | dietsubmit (const char *hostname, const char *scriptPath, char *jobID, const size_t maxsize, char *error_message, const size_t error_maxsize) |
| Function used to submit a job on a machine with a script. | |
| int | printListOfJobs (const listOfJobs_t *listOfJobs) |
| Method used to the a list of jobs. | |
| int | printJob (const job_t *job) |
| Method used to print a job. | |
This file can be used to access the API for the DIET Batch Management System.
| int dietcancel | ( | const char * | hostname, |
| const char * | jobId, | ||
| char * | outputMessage, | ||
| const size_t | maxsize, | ||
| char * | errorMessage, | ||
| const size_t | errorSize | ||
| ) |
Function used to cancel a job on a machine with its job id.
| hostname | the name of the machine |
| jobId | the id of the job to cancel |
| outputMessage | message delivered by the scheduler |
| maxsize | the maximum length of the buffer where the output message will be stored |
| errorMessage | error message |
| errorSize | size of the error message |
Here is an example of code using the dietcancel function to cancel a job with ID "bar" on the target machine called "foo":
#include <stdio.h> #include <stdlib.h> #include "JobStructures.h" #include "diet-bms-lib.h" int main(int argc, char* argv[]){ diet_initialize(argv[1], argc, argv); char* outputMessage = (char*)malloc(255*sizeof(char)); char* errorMessage = (char*)malloc(1000*sizeof(char)); dietcancel("foo","bar",outputMessage,255, errorMessage, 1000); printf("%s\n",outputMessage); free(outputMessage); free(errorMessage); diet_finalize(); }
| int dietlist | ( | const char * | hostname, |
| listOfJobs_t * | listOfJobs, | ||
| char * | errorMessage, | ||
| const size_t | errorSize | ||
| ) |
Function used to list the jobs on a machine.
| hostname | name of the machine |
| listOfJobs | structure that will at the end contain the list of jobs |
| errorMessage | error message |
| errorSize | size of the error message |
Here is a example code using the dietlist function to retrieve the existing jobs on a machine called "foo":
#include <stdio.h> #include <stdlib.h> #include "JobStructures.h" #include "diet-bms-lib.h" int main(int argc, char* argv[]){ diet_initialize(argv[1], argc, argv); listOfJobs_t listOfJobs; char* errorMessage = (char*)malloc(1000*sizeof(char)); dietlist("foo",&listOfJobs,errorMessage,1000); printListOfJobs(&listOfJobs); free(errorMessage); diet_finalize(); }
| int dietNbJobs | ( | const char * | hostname, |
| char * | errorMessage, | ||
| const size_t | errorSize | ||
| ) |
Function used to get the number of jobs on a machine.
| hostname | name of the machine |
| errorMessage | error message |
| errorSize | size of the error message |
Here is an example of code using the dietNbJobs function to retrieve the number of jobs on the target machine called "foo":
#include <stdio.h> #include <stdlib.h> #include "JobStructures.h" #include "diet-bms-lib.h" int main(int argc, char* argv[]){ diet_initialize(argv[1], argc, argv); char* errorMessage = (char*)malloc(1000*sizeof(char)); int nbJobs = dietNbJobs("Arrakis-2.local", errorMessage, 1000); printf("Total number of jobs on %s is %d\n","Arrakis-2.local",nbJobs); free(errorMessage); diet_finalize(); }
| int dietNbRunningJobs | ( | const char * | hostname, |
| char * | errorMessage, | ||
| const size_t | errorSize | ||
| ) |
Function used to get the number of running jobs on a machine.
| hostname | name of the machine |
| errorMessage | error message |
| errorSize | size of the error message |
Here is an example of code using the dietNbRunningJobs function to retrieve the number of running jobs on the target machine called "foo":
#include <stdio.h> #include <stdlib.h> #include "JobStructures.h" #include "diet-bms-lib.h" int main(int argc, char* argv[]){ diet_initialize(argv[1], argc, argv); char* errorMessage = (char*)malloc(1000*sizeof(char)); int nbRunningJobs = dietNbRunningJobs("foo", errorMessage, 1000); printf("Total number of running jobs on %s is %d\n","foo",nbRunningJobs); free(errorMessage); diet_finalize(); }
| int dietNbWaitingJobs | ( | const char * | hostname, |
| char * | errorMessage, | ||
| const size_t | errorSize | ||
| ) |
Function used to get the number of waiting jobs on a machine.
| hostname | name of the machine |
| errorMessage | error message |
| errorSize | size of the error message |
Here is an example of code using the dietNbWaitingJobs function to retrieve the number of waiting jobs on the target machine called "foo":
#include <stdio.h> #include <stdlib.h> #include "JobStructures.h" #include "diet-bms-lib.h" int main(int argc, char* argv[]){ diet_initialize(argv[1], argc, argv); char* errorMessage = (char*) malloc(1000*sizeof(char)); int nbWaitingJobs = dietNbWaitingJobs("foo"); printf("Total number of waiting jobs on %s is %d\n","foo",nbWaitingJobs); free(errorMessage); diet_finalize(); }
| int dietsubmit | ( | const char * | hostname, |
| const char * | scriptPath, | ||
| char * | jobID, | ||
| const size_t | maxsize, | ||
| char * | error_message, | ||
| const size_t | error_maxsize | ||
| ) |
Function used to submit a job on a machine with a script.
| hostname | name of the machine |
| scriptPath | path of the script to submit |
| jobID | id of the job that has been submitted |
| maxsize | maximum size of data that should be stored in the jobID variable |
| error_message | message containing the possible error message thrown during the submission |
| error_maxsize | size of the data that should be stored in the error_message variable |
Here is an example of code using the dietsubmit function to submit a job with scrip file bar.txt on the target machine called "foo":
#include <stdio.h> #include <stdlib.h> #include "JobStructures.h" #include "diet-bms-lib.h" int main(int argc, char* argv[]){ diet_initialize(argv[1], argc, argv); char* jobID = (char*)malloc(255*sizeof(char)); char* errorMessage = (char*)malloc(1000*sizeof(char)); dietsubmit("foo","bat.txt", jobID,255, errorMessage, 1000); printf("%s\n",jobID); free(jobID); diet_finalize(); }
| int printJob | ( | const job_t * | job ) |
Method used to print a job.
| job | a job to pring |
| int printListOfJobs | ( | const listOfJobs_t * | listOfJobs ) |
Method used to the a list of jobs.
| listOfJobs | a list of jobs to print |
1.7.2