Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
BlastServiceJob Struct Reference

This datatype stores the ServiceJob and its associated BlastTool. More...

#include <blast_service_job.h>

Inheritance diagram for BlastServiceJob:
[legend]
Collaboration diagram for BlastServiceJob:
[legend]

Public Member Functions

void CustomiseBlastServiceJob (Service *service_p, ServiceJob *job_p)
 Initialise a BlastServiceJob with its required functions for updating and freeing itself. More...
 
BlastServiceJobAllocateBlastServiceJobForDatabase (Service *service_p, const DatabaseInfo *db_p, struct BlastServiceData *data_p)
 Create a BlastServiceJob. More...
 
BlastServiceJobAllocateBlastServiceJob (Service *service_p, const char *job_name_s, const char *job_description_s, const char *tool_name_s, BlastServiceData *data_p)
 Create a BlastServiceJob. More...
 
void FreeBlastServiceJob (ServiceJob *job_p)
 Free the BlastServiceJob. More...
 
char * GetPreviousJobFilename (const BlastServiceData *data_p, const char *job_id_s, const char *suffix_s)
 Get the filename with the data for a previously-ran BlastServiceJob. More...
 
BlastServiceJobGetBlastServiceJobFromJSON (const json_t *blast_job_json_p, BlastServiceData *config_p)
 Deserialise a BlastServiceJob from a JSON fragment. More...
 
json_t * ConvertBlastServiceJobToJSON (BlastServiceJob *job_p, bool omit_results_flag)
 Serialise a BlastServiceJob into a JSON fragment. More...
 
bool AddErrorToBlastServiceJob (BlastServiceJob *job_p)
 Add the logged information from a failed BlastServiceJob to its list of stored errors. More...
 
bool UpdateBlastServiceJob (ServiceJob *job_p)
 Update the running status of BlastServiceJob if needed. More...
 
bool ProcessLinkedServiceForBlastServiceJobOutput (Service *service_p, ServiceJob *job_p, LinkedService *linked_service_p)
 Process a LinkedService for a given BlastServiceJob. More...
 
void BlastServiceJobCompleted (ServiceJob *job_p)
 This is the callback function used by an AsyncTask that is called when a BlastServiceJob has completed running. More...
 
bool AddHsp (json_t *marked_up_hit_p, const json_t *hsp_p)
 Add the marked-up data for a High-scoring Segment Pair (HSP) to a marked-up hit. More...
 
bool GetAndAddDatabaseMappedParameter (LinkedService *linked_service_p, const json_t *report_p, ParameterSet *output_params_p, const char **database_ss)
 After the blast job has ran, get the database that it ran against from a hit from within SINGLE_JSON_FILE output formatted result. More...
 
const json_t * GetScaffoldsForDatabaseHit (const json_t *hit_p)
 After the blast job has ran, get the scaffolds that it ran against from a hit from within SINGLE_JSON_FILE output formatted result. More...
 
json_t * MarkUpBlastResult (BlastServiceJob *job_p)
 Get the Grassroots marked-up data from a BlastServiceJob. More...
 
- Public Member Functions inherited from ServiceJob
void FreeServiceJob (ServiceJob *job_p)
 Free a ServiceJob. More...
 
void FreeBaseServiceJob (ServiceJob *job_p)
 Free a ServiceJob ignoring if it is a subclass. More...
 
ServiceJobAllocateServiceJob (struct Service *service_p, const char *job_name_s, const char *job_description_s, bool(*update_fn)(struct ServiceJob *job_p), bool(*calculate_results_fn)(struct ServiceJob *job_p), void(*free_job_fn)(struct ServiceJob *job_p), const char *job_type_s)
 Allocate a ServiceJob. More...
 
ServiceJobCreateAndAddServiceJobToService (struct Service *service_p, const char *job_name_s, const char *job_description_s, bool(*update_fn)(struct ServiceJob *job_p), bool(*calculate_results_fn)(struct ServiceJob *job_p), void(*free_job_fn)(struct ServiceJob *job_p))
 Allocate a ServiceJob and add it to a ServiceJobSet. More...
 
bool InitServiceJob (ServiceJob *job_p, struct Service *service_p, const char *job_name_s, const char *job_description_s, bool(*update_fn)(struct ServiceJob *job_p), bool(*calculate_results_fn)(struct ServiceJob *job_p), void(*free_job_fn)(struct ServiceJob *job_p), uuid_t *id_p, const char *job_type_s)
 Initialise a ServiceJob. More...
 
void ClearServiceJob (ServiceJob *job_p)
 Clear a Service Job ready for reuse. More...
 
ServiceJobCloneServiceJob (const ServiceJob *src_p)
 Create a deep copy of a ServiceJob. More...
 
bool CopyServiceJob (const ServiceJob *src_p, ServiceJob *dest_p)
 Make a deep copy of one ServiceJob to another. More...
 
struct ServiceGetServiceFromServiceJob (ServiceJob *job_p)
 Get the owning Service for a given ServiceJob. More...
 
bool SetServiceJobDescription (ServiceJob *job_p, const char *const description_s)
 Set the description of ServiceJob. More...
 
bool SetServiceJobURL (ServiceJob *job_p, const char *const url_s)
 Set the description of ServiceJob. More...
 
bool SetServiceJobName (ServiceJob *job_p, const char *const name_s)
 Set the name of ServiceJob. More...
 
json_t * GetServiceJobAsJSON (ServiceJob *const job_p, bool omit_results_flag)
 Get a ServiceJob as JSON. More...
 
json_t * GetServiceJobStatusAsJSON (ServiceJob *job_p, bool omit_results_flag)
 Get the Current OperationStatus of a ServiceJob as JSON. More...
 
ServiceJobCreateServiceJobFromJSON (const json_t *job_json_p, GrassrootsServer *grassroots_p)
 Create a ServiceJob from a json_t object. More...
 
bool InitServiceJobFromJSON (ServiceJob *job_p, const json_t *json_p, struct Service *service_p, GrassrootsServer *grassroots_p)
 Get a ServiceJob from a json_t object. More...
 
OperationStatus GetServiceJobStatus (ServiceJob *job_p)
 Get the Current OperationStatus of a ServiceJob. More...
 
OperationStatus GetCachedServiceJobStatus (const ServiceJob *job_p)
 Get the last retrieved OperationStatus of a ServiceJob. More...
 
const char * GetServiceJobName (const ServiceJob *job_p)
 Get the name of ServiceJob. More...
 
bool CloseServiceJob (ServiceJob *job_p)
 Close a ServiceJob. More...
 
void ClearServiceJobResults (ServiceJob *job_p, bool free_memory_flag)
 Clear the results associated with a ServiceJob. More...
 
char * SerialiseServiceJobToJSON (ServiceJob *const job_p, bool omit_results_flag)
 Save the ServiceJob to a persistent format that allows the ServiceJob to be recreated in a potentially different thread and/or process. More...
 
ServiceJobCreateServiceJobFromResultsJSON (const json_t *results_p, struct Service *service_p, const char *name_s, const char *description_s, OperationStatus status, const char *job_type_s)
 Create a ServiceJob from a JSON Resource fragment. More...
 
bool InitServiceJobFromResultsJSON (ServiceJob *job_p, const json_t *results_p, struct Service *service_p, const char *name_s, const char *description_s, OperationStatus status, const char *job_type_s)
 Fill in the data for a ServiceJob from a given JSON fragement. More...
 
bool AddParameterErrorMessageToServiceJob (ServiceJob *job_p, const char *const param_s, const ParameterType param_type, const char *const value_s)
 Add a key-value pair error statement to a ServiceJob. More...
 
bool AddGeneralErrorMessageToServiceJob (ServiceJob *job_p, const char *const value_s)
 Add a key-value pair error statement to a ServiceJob. More...
 
bool AddCompoundErrorToServiceJob (ServiceJob *job_p, const char *param_s, const ParameterType param_type, json_t *error_details_p)
 Add a key-value pair error statement to a ServiceJob. More...
 
bool AddResultToServiceJob (ServiceJob *job_p, json_t *result_p)
 Add a result to ServiceJob. More...
 
void SetServiceJobStatus (ServiceJob *job_p, OperationStatus status)
 Set the current OperationStatus for a given ServiceJob. More...
 
void SetServiceJobUpdateFunction (ServiceJob *job_p, bool(*update_fn)(ServiceJob *job_p))
 Set the function that a ServiceJob will use to update itself. More...
 
void SetServiceJobFreeFunction (ServiceJob *job_p, void(*free_fn)(ServiceJob *job_p))
 Set the function that a ServiceJob will use to free itself. More...
 
void SetServiceJobCalculateResultFunction (ServiceJob *job_p, bool(*calculate_fn)(ServiceJob *job_p))
 Set the function that a ServiceJob will use to calculate its results. More...
 
bool UpdateServiceJob (ServiceJob *job_p)
 Update, if appropriate, a given ServiceJob. More...
 
uint32 GetNumberOfServiceJobResults (const ServiceJob *job_p)
 Get the number of results stored on a ServiceJob. More...
 
bool ReplaceServiceJobResults (ServiceJob *job_p, json_t *results_p)
 Replace the set of results for a given ServiceJob. More...
 
bool AddLinkedServiceToServiceJob (ServiceJob *job_p, struct LinkedService *linked_service_p)
 Add a LinkedService to ServiceJob. More...
 
void ProcessLinkedServices (ServiceJob *job_p)
 Attempt to extract the relevant data for all LinkedServices that the ServiceJob's Service has and store them in the ServiceJob. More...
 
bool CalculateServiceJobResult (ServiceJob *job_p)
 Calculate the results for the given ServiceJob. More...
 
void SetServiceJobUUID (ServiceJob *job_p, const uuid_t new_job_id)
 Replace the uuid for a given ServiceJob. More...
 

Data Fields

const char * BSJ_TYPE_S = "blast_service_job"
 The type for BlastServiceJobs. More...
 
ServiceJob bsj_job
 The ServiceJob. More...
 
BlastToolbsj_tool_p
 The BlastTool. More...
 
- Data Fields inherited from ServiceJob
struct Servicesj_service_p
 The Service that is running this job. More...
 
uuid_t sj_id
 The unique identifier for this job. More...
 
enum OperationStatus sj_status
 Is the service currently in an open state? More...
 
char * sj_service_name_s
 The name of the Service that this ServiceJob is for. More...
 
char * sj_name_s
 The name of the ServiceJob. More...
 
char * sj_description_s
 The description of the ServiceJob. More...
 
char * sj_url_s
 Any user-facing URL for showing results of running this ServiceJob. More...
 
json_t * sj_result_p
 The JSON fragment for the results of this ServiceJob. More...
 
json_t * sj_metadata_p
 The JSON fragment for any extra information for this ServiceJob. More...
 
json_t * sj_errors_p
 The JSON fragment for any errors that have occurred whilst running this ServiceJob. More...
 
json_t * sj_linked_services_p
 A JSON array where each object contains the details of running a different Service based upon the results of this ServiceJob. More...
 
bool(* sj_update_fn )(struct ServiceJob *job_p)
 The callback function to use when checking the status of this ServiceJob. More...
 
void(* sj_free_fn )(struct ServiceJob *job_p)
 The callback function to use when freeing this ServiceJob. More...
 
bool(* sj_calculate_result_fn )(struct ServiceJob *job_p)
 The callback function to use when a ServiceJob needs to generate its results This is useful for subclasses of ServiceJob that need custom behaviour. More...
 
bool sj_is_updating_flag
 Is this ServiceJob in the process of updating itself? More...
 
char * sj_type_s
 The type of ServiceJob. More...
 

Detailed Description

This datatype stores the ServiceJob and its associated BlastTool.

Member Function Documentation

◆ CustomiseBlastServiceJob()

void CustomiseBlastServiceJob ( Service service_p,
ServiceJob job_p 
)

Initialise a BlastServiceJob with its required functions for updating and freeing itself.

Parameters
service_pThe BlastService that has created the BlastServiceJob.
job_pThe BlastServiceJob.

◆ AllocateBlastServiceJobForDatabase()

BlastServiceJob * AllocateBlastServiceJobForDatabase ( Service service_p,
const DatabaseInfo db_p,
struct BlastServiceData data_p 
)

Create a BlastServiceJob.

Parameters
service_pThe Blast service.
db_pThe DatabaseInfo details that the BlastServiceJob will run against.
data_pThe BlastServiceData.
Returns
The newly-allocated BlastServiceJob or NULL upon error.

◆ AllocateBlastServiceJob()

BlastServiceJob * AllocateBlastServiceJob ( Service service_p,
const char *  job_name_s,
const char *  job_description_s,
const char *  tool_name_s,
BlastServiceData data_p 
)

Create a BlastServiceJob.

Parameters
service_pThe Blast service.
job_name_sThe name of the BlastServiceJob.
job_description_sThe description of the BlastServiceJob. This can be NULL.
tool_name_sThe name to give to the underlying BlastTool for this BlastServiceJob. This value will be deep-copied.
data_pThe BlastServiceData.
Returns
The newly-allocated BlastServiceJob or NULL upon error.

◆ FreeBlastServiceJob()

void FreeBlastServiceJob ( ServiceJob job_p)

Free the BlastServiceJob.

Parameters
job_pThe BlastServiceJob to free.

◆ GetPreviousJobFilename()

char * GetPreviousJobFilename ( const BlastServiceData data_p,
const char *  job_id_s,
const char *  suffix_s 
)

Get the filename with the data for a previously-ran BlastServiceJob.

Parameters
data_pThe configuration data for the BlastService that ran the BlastServiceJob.
job_id_sA string containing the UUID for the BlastServiceJob.
suffix_sThe file suffix to append.
Returns
The appropriate filename or NULL upon error.
See also
BS_INPUT_SUFFIX_S
BS_OUTPUT_SUFFIX_S
BS_LOG_SUFFIX_S

◆ GetBlastServiceJobFromJSON()

BlastServiceJob * GetBlastServiceJobFromJSON ( const json_t *  blast_job_json_p,
BlastServiceData config_p 
)

Deserialise a BlastServiceJob from a JSON fragment.

Parameters
blast_job_json_pThe JSON fragment to generate the BlastServiceJob from .
config_pThe configuration data for the Blast Service.
Returns
The newly-created BlastServiceJob or NULL upon error.

◆ ConvertBlastServiceJobToJSON()

json_t * ConvertBlastServiceJobToJSON ( BlastServiceJob job_p,
bool  omit_results_flag 
)

Serialise a BlastServiceJob into a JSON fragment.

Parameters
job_pThe BlastServiceJob to serialise
omit_results_flagtrue if the BlastServiceJob is to exclude any results from the created JSON fragment, false to include them.
Returns
The newly-created JSON fragment or NULL upon error.

◆ AddErrorToBlastServiceJob()

bool AddErrorToBlastServiceJob ( BlastServiceJob job_p)

Add the logged information from a failed BlastServiceJob to its list of stored errors.

Parameters
job_pThe BlastServiceJob to update
Returns
true if the BlastServiceJob had its errors updated successfully, false otherwise.

◆ UpdateBlastServiceJob()

bool UpdateBlastServiceJob ( ServiceJob job_p)

Update the running status of BlastServiceJob if needed.

Parameters
job_pThe BlastServiceJob to check.
Returns
true if the BlastServiceJob was updated successfully, false otherwise.

◆ ProcessLinkedServiceForBlastServiceJobOutput()

bool ProcessLinkedServiceForBlastServiceJobOutput ( Service service_p,
ServiceJob job_p,
LinkedService linked_service_p 
)

Process a LinkedService for a given BlastServiceJob.

Parameters
service_pThe BlastService that generated the BlastServiceJob.
job_pThe BlastServiceJob to process for LinkedSrevice results.
linked_service_pThe LinkedService definition to produce the values for.
Returns
true if the BlastServiceJob was processed successfully, false otherwise.

◆ BlastServiceJobCompleted()

void BlastServiceJobCompleted ( ServiceJob job_p)

This is the callback function used by an AsyncTask that is called when a BlastServiceJob has completed running.

This is used when by AsyncSystemBlastTool objects.

Parameters
job_pThe BlastServiceJob that has completed running.

◆ AddHsp()

bool AddHsp ( json_t *  marked_up_hit_p,
const json_t *  hsp_p 
)

Add the marked-up data for a High-scoring Segment Pair (HSP) to a marked-up hit.

Parameters
marked_up_hit_pThe marked-up hit that the HSP will be added to.
hsp_pThe HSP to add.
Returns
true if the HSP was added successfully, false otherwise.

◆ GetAndAddDatabaseMappedParameter()

bool GetAndAddDatabaseMappedParameter ( LinkedService linked_service_p,
const json_t *  report_p,
ParameterSet output_params_p,
const char **  database_ss 
)

After the blast job has ran, get the database that it ran against from a hit from within SINGLE_JSON_FILE output formatted result.

Parameters
report_pThe JSON fragment for the report.

◆ GetScaffoldsForDatabaseHit()

const json_t * GetScaffoldsForDatabaseHit ( const json_t *  hit_p)

After the blast job has ran, get the scaffolds that it ran against from a hit from within SINGLE_JSON_FILE output formatted result.

Parameters
hit_pThe JSON fragment for the hit.
Returns
A JSON array where each element is an object with "scaffold" as the key and the scaffold name as the value or NULL upon error.

◆ MarkUpBlastResult()

json_t * MarkUpBlastResult ( BlastServiceJob job_p)

Get the Grassroots marked-up data from a BlastServiceJob.

Parameters
job_pThe BlastServiceJob to get the marked-up result for.
Returns
The JSON fragment containing the marked-up data or NULL upon error.

Field Documentation

◆ BSJ_TYPE_S

const char* BSJ_TYPE_S = "blast_service_job"

The type for BlastServiceJobs.

◆ bsj_job

ServiceJob bsj_job

The ServiceJob.

◆ bsj_tool_p

BlastTool* bsj_tool_p

The BlastTool.


The documentation for this struct was generated from the following files: