+
+ if (!(task = xbt_dict_get_or_null(jobs, name))) {
+ if (seq_or_par == sequential){
+ task = SD_task_create_comp_seq(name, NULL , amount);
+ } else {
+ task = SD_task_create_comp_par_amdahl(name, NULL , amount, alpha);
+ }
+ TRACE_sd_dotloader (task, agget (node, (char*)"category"));
+ xbt_dict_set(jobs, name, task, NULL);
+ if (!strcmp(name, "root")){
+ /* by design the root task is always SCHEDULABLE */
+ __SD_task_set_state(task, SD_SCHEDULABLE);
+ /* Put it at the beginning of the dynar */
+ xbt_dynar_insert_at(result, 0, &task);
+ } else {
+ if (!strcmp(name, "end")){
+ XBT_DEBUG("Declaration of the 'end' node, don't store it yet.");
+ end = task;
+ /* Should be inserted later in the dynar */
+ } else {
+ xbt_dynar_push(result, &task);
+ }
+ }
+
+ if((seq_or_par == sequential) &&
+ (schedule ||
+ XBT_LOG_ISENABLED(sd_dotparse, xbt_log_priority_verbose))){
+ /* try to take the information to schedule the task only if all is
+ * right*/
+ int performer, order;
+ char *char_performer = agget(node, (char *) "performer");
+ char *char_order = agget(node, (char *) "order");
+ /* performer is the computer which execute the task */
+ performer =
+ ((!char_performer || !strcmp(char_performer,"")) ? -1:atoi(char_performer));
+ /* order is giving the task order on one computer */
+ order = ((!char_order || !strcmp(char_order, ""))? -1:atoi(char_order));
+
+ XBT_DEBUG ("Task '%s' is scheduled on workstation '%d' in position '%d'",
+ task->name, performer, order);
+ xbt_dynar_t computer = NULL;
+ if(performer != -1 && order != -1){
+ /* required parameters are given */
+ computer = xbt_dict_get_or_null(computers, char_performer);
+ if(computer == NULL){
+ computer = xbt_dynar_new(sizeof(SD_task_t), NULL);
+ xbt_dict_set(computers, char_performer, computer, NULL);
+ }
+ if(performer < xbt_lib_length(host_lib)){
+ /* the wanted computer is available */
+ SD_task_t *task_test = NULL;
+ if(order < computer->used)
+ task_test = xbt_dynar_get_ptr(computer,order);
+ if(task_test != NULL && *task_test != NULL && *task_test != task){
+ /* the user gives the same order to several tasks */
+ schedule = false;
+ XBT_VERB("The task %s starts on the computer %s at the position : %s like the task %s",
+ (*task_test)->name, char_performer, char_order,
+ task->name);
+ }else{
+ /* the parameter seems to be ok */
+ xbt_dynar_set_as(computer, order, SD_task_t, task);
+ }
+ }else{
+ /* the platform has not enough processors to schedule the DAG like
+ * the user wants*/
+ schedule = false;
+ XBT_VERB("The schedule is ignored, there are not enough computers");
+ }
+ }
+ else {
+ /* one of required parameters is not given */
+ schedule = false;
+ XBT_VERB("The schedule is ignored, the task %s is not correctly scheduled",
+ task->name);
+ }
+ }
+ } else {
+ XBT_WARN("Task '%s' is defined more than once", name);