Ignore:
Timestamp:
May 3, 2017, 12:53:06 PM (7 years ago)
Author:
djay
Message:

Commit the minimal requirements for remote HPC support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/zoo-project/zoo-kernel/zoo_service_loader.c

    r817 r822  
    2626extern "C" int crlex ();
    2727
     28#ifdef META_DB
     29#include "ogrsf_frmts.h"
     30#if GDAL_VERSION_MAJOR >= 2
     31#include <gdal_priv.h>
     32#endif
     33#endif
     34
    2835#ifdef USE_OTB
    2936#include "service_internal_otb.h"
     37#endif
     38
     39#ifdef USE_HPC
     40#include "service_internal_hpc.h"
    3041#endif
    3142
     
    5364#ifdef WIN32
    5465#include "caching.h"
     66#endif
     67
     68#ifdef META_DB
     69#include "meta_sql.h"
    5570#endif
    5671
     
    305320                  return -1;
    306321                }
    307   #ifdef DEBUG
     322  #ifndef DEBUG
    308323              fprintf (stderr, "#################\n%s\n#################\n",
    309324                       tmps1);
     
    330345              fflush (stderr);
    331346  #endif
    332         inheritance(r,&s1);
     347              inheritance(r,&s1);
    333348              func (r, m, n, s1);
    334349              freeService (&s1);
     
    631646  else
    632647
     648#ifdef USE_HPC
     649  if (strncasecmp (r_inputs->value, "HPC", 3) == 0)
     650    {
     651      *eres =
     652        zoo_hpc_support (&m, request_inputs, s1,
     653                            &request_input_real_format,
     654                            &request_output_real_format);
     655    }
     656  else
     657#endif
     658
    633659#ifdef USE_SAGA
    634   if (strncasecmp (r_inputs->value, "SAGA", 6) == 0)
     660  if (strncasecmp (r_inputs->value, "SAGA", 4) == 0)
    635661    {
    636662      *eres =
     
    643669
    644670#ifdef USE_OTB
    645   if (strncasecmp (r_inputs->value, "OTB", 6) == 0)
     671  if (strncasecmp (r_inputs->value, "OTB", 3) == 0)
    646672    {
    647673      *eres =
     
    13041330      fflush (stdout);
    13051331      dup2 (saved_stdout, fileno (stdout));
     1332#ifdef META_DB
     1333      fetchServicesFromDb(zooRegistry,m,n,printGetCapabilitiesForProcess);
     1334#endif     
    13061335      printDocument (m, doc, getpid ());
    13071336      freeMaps (&m);
     
    14121441                                    printDescribeProcessForProcess) < 0)
    14131442                  return res;
     1443#ifdef META_DB
     1444                fetchServicesFromDb(zooRegistry,m,n,printDescribeProcessForProcess);
     1445#endif     
     1446
    14141447              }
    14151448            else
     
    14271460                    if (import != NULL && import->value != NULL)
    14281461                      {
    1429                         s1 = (service *) malloc (SERVICE_SIZE);
    1430                         t = readServiceFile (m, import->value, &s1, import->name);
     1462#ifdef META_DB                 
     1463                        service* s2=extractServiceFromDb(m,import->name);
     1464                        fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
     1465                        fflush(stderr);
     1466                        if(s2==NULL){
     1467#endif
     1468                          s1 = (service *) malloc (SERVICE_SIZE);
     1469                          t = readServiceFile (m, import->value, &s1, import->name);
    14311470               
    1432                         if (t < 0) // failure reading zcfg
    1433                           {
    1434                             map *tmp00 = getMapFromMaps (m, "lenv", "message");
    1435                             char tmp01[1024];
    1436                             if (tmp00 != NULL)
    1437                               sprintf (tmp01, _("Unable to parse the ZCFG file: %s (%s)"), import->value, tmp00->value);
    1438                             else
    1439                               sprintf (tmp01, _("Unable to parse the ZCFG file: %s."), import->value);
    1440 
    1441                             dup2 (saved_stdout, fileno (stdout));
    1442                             errorException (m, tmp01, "InternalError", NULL);
    1443            
    1444                             freeMaps (&m);
    1445                             free (m);
    1446 
    1447                             if(zooRegistry!=NULL){
    1448                               freeRegistry(&zooRegistry);
    1449                               free(zooRegistry);
     1471                          if (t < 0) // failure reading zcfg
     1472                            {
     1473                              map *tmp00 = getMapFromMaps (m, "lenv", "message");
     1474                              char tmp01[1024];
     1475                              if (tmp00 != NULL)
     1476                                sprintf (tmp01, _("Unable to parse the ZCFG file: %s (%s)"), import->value, tmp00->value);
     1477                              else
     1478                                sprintf (tmp01, _("Unable to parse the ZCFG file: %s."), import->value);
     1479                             
     1480                              dup2 (saved_stdout, fileno (stdout));
     1481                              errorException (m, tmp01, "InternalError", NULL);
     1482                             
     1483                              freeMaps (&m);
     1484                              free (m);
     1485
     1486                              if(zooRegistry!=NULL){
     1487                                freeRegistry(&zooRegistry);
     1488                                free(zooRegistry);
     1489                              }
     1490                              free (orig);
     1491                              free (REQUEST);
     1492                              closedir (dirp);
     1493                              xmlFreeDoc (doc);
     1494                              xmlCleanupParser ();
     1495                              zooXmlCleanupNs ();
     1496                   
     1497                              return 1;
    14501498                            }
    1451                             free (orig);
    1452                             free (REQUEST);
    1453                             closedir (dirp);
    1454                             xmlFreeDoc (doc);
    1455                             xmlCleanupParser ();
    1456                             zooXmlCleanupNs ();
    1457                    
    1458                             return 1;
    1459                           }
    1460 #ifdef DEBUG
    1461                         dumpService (s1);
    1462 #endif
    1463 
    1464                         inheritance(zooRegistry,&s1);
    1465                         printDescribeProcessForProcess (zooRegistry,m, n, s1);
    1466                         freeService (&s1);
    1467                         free (s1);
    1468                         s1 = NULL;
    1469                         scount++;
    1470                         hasVal = 1;               
    1471                     }
     1499#ifdef DEBUG
     1500                          dumpService (s1);
     1501#endif
     1502
     1503                          inheritance(zooRegistry,&s1);
     1504                          printDescribeProcessForProcess (zooRegistry,m, n, s1);
     1505                          freeService (&s1);
     1506                          free (s1);
     1507                          s1 = NULL;
     1508                          scount++;
     1509                          hasVal = 1;               
     1510#ifdef META_DB
     1511                        }
     1512#endif
     1513                      }
    14721514                    else if (strstr (corig, ".") != NULL)
    14731515                      {
     
    14791521                        map *tmpMapI = getMapFromMaps (m, "lenv", "Identifier");
    14801522
    1481                         s1 = (service *) malloc (SERVICE_SIZE);
    1482                         t = readServiceFile (m, buff1, &s1, tmpMapI->value);
    1483                         if (t < 0)
    1484                           {
    1485                             map *tmp00 = getMapFromMaps (m, "lenv", "message");
    1486                             char tmp01[1024];
    1487                             if (tmp00 != NULL)
    1488                               sprintf (tmp01,
    1489                                        _
    1490                                        ("Unable to parse the ZCFG file for the following ZOO-Service: %s. Message: %s"),
    1491                                        tmps, tmp00->value);
    1492                             else
    1493                               sprintf (tmp01,
    1494                                        _
    1495                                        ("Unable to parse the ZCFG file for the following ZOO-Service: %s."),
    1496                                        tmps);
    1497                             dup2 (saved_stdout, fileno (stdout));
    1498                             errorException (m, tmp01, "InvalidParameterValue",
    1499                                             "identifier");
    1500                             freeMaps (&m);
    1501                             free (m);
    1502                             if(zooRegistry!=NULL){
    1503                               freeRegistry(&zooRegistry);
    1504                               free(zooRegistry);
     1523#ifdef META_DB
     1524                        service* s2=extractServiceFromDb(m,tmpMapI->name);
     1525                        fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
     1526                        fflush(stderr);
     1527                        if(s2==NULL){
     1528#endif
     1529                          s1 = (service *) malloc (SERVICE_SIZE);
     1530                          t = readServiceFile (m, buff1, &s1, tmpMapI->value);
     1531                          if (t < 0)
     1532                            {
     1533                              map *tmp00 = getMapFromMaps (m, "lenv", "message");
     1534                              char tmp01[1024];
     1535                              if (tmp00 != NULL)
     1536                                sprintf (tmp01,
     1537                                         _
     1538                                         ("Unable to parse the ZCFG file for the following ZOO-Service: %s. Message: %s"),
     1539                                         tmps, tmp00->value);
     1540                              else
     1541                                sprintf (tmp01,
     1542                                         _
     1543                                         ("Unable to parse the ZCFG file for the following ZOO-Service: %s."),
     1544                                         tmps);
     1545                              dup2 (saved_stdout, fileno (stdout));
     1546                              errorException (m, tmp01, "InvalidParameterValue",
     1547                                              "identifier");
     1548                              freeMaps (&m);
     1549                              free (m);
     1550                              if(zooRegistry!=NULL){
     1551                                freeRegistry(&zooRegistry);
     1552                                free(zooRegistry);
     1553                              }
     1554                              free (REQUEST);
     1555                              free (corig);
     1556                              free (orig);
     1557                              free (SERVICE_URL);
     1558                              free (s1);
     1559                              closedir (dirp);
     1560                              xmlFreeDoc (doc);
     1561                              xmlCleanupParser ();
     1562                              zooXmlCleanupNs ();
     1563                              return 1;
    15051564                            }
    1506                             free (REQUEST);
    1507                             free (corig);
    1508                             free (orig);
    1509                             free (SERVICE_URL);
    1510                             free (s1);
    1511                             closedir (dirp);
    1512                             xmlFreeDoc (doc);
    1513                             xmlCleanupParser ();
    1514                             zooXmlCleanupNs ();
    1515                             return 1;
    1516                           }
    1517 #ifdef DEBUG
    1518                         dumpService (s1);
    1519 #endif
    1520                         inheritance(zooRegistry,&s1);
    1521                         printDescribeProcessForProcess (zooRegistry,m, n, s1);
    1522                         freeService (&s1);
    1523                         free (s1);
    1524                         s1 = NULL;
    1525                         scount++;
    1526                         hasVal = 1;
    1527                         setMapInMaps (m, "lenv", "level", "0");
     1565#ifdef DEBUG
     1566                          dumpService (s1);
     1567#endif
     1568                          inheritance(zooRegistry,&s1);
     1569                          printDescribeProcessForProcess (zooRegistry,m, n, s1);
     1570                          freeService (&s1);
     1571                          free (s1);
     1572                          s1 = NULL;
     1573                          scount++;
     1574                          hasVal = 1;
     1575                          setMapInMaps (m, "lenv", "level", "0");
     1576#ifdef META_DB
     1577                        }
     1578#endif
    15281579                      }
    15291580                    else
    15301581                      {
     1582                        fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
     1583                        fflush(stderr);
     1584#ifdef META_DB
     1585                        _init_sql(m,"metadb");
     1586                        service* s2=extractServiceFromDb(m,corig);
     1587                        if(s2!=NULL){
     1588                          fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
     1589                          fflush(stderr);
     1590                          inheritance(zooRegistry,&s2);
     1591                          printDescribeProcessForProcess (zooRegistry,m, n, s2);
     1592                          freeService (&s2);
     1593                          free (s2);
     1594                          s2 = NULL;
     1595                          hasVal = 1;
     1596                        }else /*TOTO*/{
     1597#endif
    15311598                        memset (buff, 0, 256);
    15321599                        snprintf (buff, 256, "%s.zcfg", corig);
    15331600                        memset (buff1, 0, 1024);
    15341601#ifdef DEBUG
    1535                         printf ("\n#######%s\n########\n", buff);
    1536 #endif
    1537                         while ((dp = readdir (dirp)) != NULL)
    1538                           {
    1539                             if (strcasecmp (dp->d_name, buff) == 0)
    1540                               {
    1541                                 memset (buff1, 0, 1024);
    1542                                 snprintf (buff1, 1024, "%s/%s", conf_dir,
    1543                                           dp->d_name);
    1544                                 s1 = (service *) malloc (SERVICE_SIZE);
    1545                                 if (s1 == NULL)
    1546                                   {
    1547                                     dup2 (saved_stdout, fileno (stdout));
    1548                                     return errorException (m,
    1549                                                            _
    1550                                                            ("Unable to allocate memory"),
    1551                                                            "InternalError",
    1552                                                            NULL);
    1553                                   }
     1602                          printf ("\n#######%s\n########\n", buff);
     1603#endif
     1604                          while ((dp = readdir (dirp)) != NULL)
     1605                            {
     1606                              if (strcasecmp (dp->d_name, buff) == 0)
     1607                                {
     1608                                  memset (buff1, 0, 1024);
     1609                                  snprintf (buff1, 1024, "%s/%s", conf_dir,
     1610                                            dp->d_name);
     1611                                  s1 = (service *) malloc (SERVICE_SIZE);
     1612                                  if (s1 == NULL)
     1613                                    {
     1614                                      dup2 (saved_stdout, fileno (stdout));
     1615                                      return errorException (m,
     1616                                                             _
     1617                                                             ("Unable to allocate memory"),
     1618                                                             "InternalError",
     1619                                                             NULL);
     1620                                    }
    15541621#ifdef DEBUG_SERVICE_CONF
    1555                                 fprintf
    1556                                   (stderr,"#################\n(%s) %s\n#################\n",
    1557                                    r_inputs->value, buff1);
    1558 #endif
    1559                                 char *tmp0 = zStrdup (dp->d_name);
    1560                                 tmp0[strlen (tmp0) - 5] = 0;
    1561                                 t = readServiceFile (m, buff1, &s1, tmp0);
    1562                                 free (tmp0);
    1563                                 if (t < 0)
    1564                                   {
    1565                                     map *tmp00 =
    1566                                       getMapFromMaps (m, "lenv", "message");
    1567                                     char tmp01[1024];
    1568                                     if (tmp00 != NULL)
    1569                                       sprintf (tmp01,
    1570                                                _
    1571                                                ("Unable to parse the ZCFG file: %s (%s)"),
    1572                                                dp->d_name, tmp00->value);
    1573                                     else
    1574                                       sprintf (tmp01,
    1575                                                _
    1576                                                ("Unable to parse the ZCFG file: %s."),
    1577                                                dp->d_name);
    1578                                     dup2 (saved_stdout, fileno (stdout));
    1579                                     errorException (m, tmp01, "InternalError",
    1580                                                     NULL);
    1581                                     freeMaps (&m);
    1582                                     free (m);
    1583                                     if(zooRegistry!=NULL){
    1584                                       freeRegistry(&zooRegistry);
    1585                                       free(zooRegistry);
     1622                                  fprintf
     1623                                    (stderr,"#################\n(%s) %s\n#################\n",
     1624                                     r_inputs->value, buff1);
     1625#endif
     1626                                  char *tmp0 = zStrdup (dp->d_name);
     1627                                  tmp0[strlen (tmp0) - 5] = 0;
     1628                                  t = readServiceFile (m, buff1, &s1, tmp0);
     1629                                  free (tmp0);
     1630                                  if (t < 0)
     1631                                    {
     1632                                      map *tmp00 =
     1633                                        getMapFromMaps (m, "lenv", "message");
     1634                                      char tmp01[1024];
     1635                                      if (tmp00 != NULL)
     1636                                        sprintf (tmp01,
     1637                                                 _
     1638                                                 ("Unable to parse the ZCFG file: %s (%s)"),
     1639                                                 dp->d_name, tmp00->value);
     1640                                      else
     1641                                        sprintf (tmp01,
     1642                                                 _
     1643                                                 ("Unable to parse the ZCFG file: %s."),
     1644                                                 dp->d_name);
     1645                                      dup2 (saved_stdout, fileno (stdout));
     1646                                      errorException (m, tmp01, "InternalError",
     1647                                                      NULL);
     1648                                      freeMaps (&m);
     1649                                      free (m);
     1650                                      if(zooRegistry!=NULL){
     1651                                        freeRegistry(&zooRegistry);
     1652                                        free(zooRegistry);
     1653                                      }
     1654                                      free (orig);
     1655                                      free (REQUEST);
     1656                                      closedir (dirp);
     1657                                      xmlFreeDoc (doc);
     1658                                      xmlCleanupParser ();
     1659                                      zooXmlCleanupNs ();
     1660                                      return 1;
    15861661                                    }
    1587                                     free (orig);
    1588                                     free (REQUEST);
    1589                                     closedir (dirp);
    1590                                     xmlFreeDoc (doc);
    1591                                     xmlCleanupParser ();
    1592                                     zooXmlCleanupNs ();
    1593                                     return 1;
    1594                                   }
    1595 #ifdef DEBUG
    1596                                 dumpService (s1);
    1597 #endif
    1598                                 inheritance(zooRegistry,&s1);
    1599                                 printDescribeProcessForProcess (zooRegistry,m, n, s1);
    1600                                 freeService (&s1);
    1601                                 free (s1);
    1602                                 s1 = NULL;
    1603                                 scount++;
    1604                                 hasVal = 1;
    1605                               }
    1606                           }
    1607                       }
     1662#ifdef DEBUG
     1663                                  dumpService (s1);
     1664#endif
     1665                                  inheritance(zooRegistry,&s1);
     1666                                  printDescribeProcessForProcess (zooRegistry,m, n, s1);
     1667                                  freeService (&s1);
     1668                                  free (s1);
     1669                                  s1 = NULL;
     1670                                  scount++;
     1671                                  hasVal = 1;
     1672                                }
     1673                            }
     1674#ifdef META_DB
     1675                        }
     1676#endif
     1677                      }               
    16081678                    if (hasVal < 0)
    16091679                      {
     
    23652435    }
    23662436
    2367 #ifdef DEBUG
     2437  //#ifdef DEBUG
    23682438  dumpMaps (request_output_real_format);
    2369 #endif
    2370 
     2439  //#endif
     2440  //sleep(120);
    23712441  if (eres != -1)
    23722442    outputResponse (s1, request_input_real_format,
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png