Task Manager

    {info} Task Manager provides the possibility of scheduling special long lasting tasks for the following web services.

    • DB Web Services
    • Calculations Web Services
    • Structure Checker Web Services

    This documentation describes installation, administration and usage of Task Manager.

    Task Manager application is available as part of a microservices system.

    Microservices system mode

    In microservices system mode the Task Manager runs together with Config service, Discovery service, Gateway service. These three services are mandatory and optionally other services can also be part of the system. All configuration must be done in the Config module.

    DB Web Service and/or Calculations Web Services and/or Structure Checker Web Services must also run according to the tasks planned to be created, executed.

    The default configuration applies to the microservices system mode.

    The web application runs on host <server-host> and listens on port <gateway-server-port>.

    Download

    See here.

    Software requirements

    See here

    Installation

    See here.

    Module is installed into folder: jws/jws-taskmanager

    Licenses

    See here.

    " JChem Microservices DB " and/or " JChem Microservices Structure Checker " and/or " JChem Microservices Calculations " licenses are needed.

    Logging

    See here.

    Configuration

    Default configuration:

    application.properties
    server.port=8068
    logging.file.name=../logs/jws-taskmanager.log
    eureka.client.enabled=true
    bootstrap.properties
    spring.cloud.config.failFast=true
    spring.cloud.config.uri=${CONFIG_SERVER_URI:http\://localhost\:8888/}
    spring.cloud.config.retry.initialInterval=3000
    spring.cloud.config.retry.multiplier=1.2
    spring.cloud.config.retry.maxInterval=60000
    spring.cloud.config.retry.maxAttempts=100

    For more settings possibilities see spring documentation page.

    Retry mechanism

    Task manager and the services it communicates with have a retry mechanism implemented in them when they call out to each other. This is adjustable with these two properties in all of these services, in their application.properties file

    com.chemaxon.retrytemplate.backOffPeriod=10000
    com.chemaxon.retrytemplate.maxAttempts=20

    BackOffPeriod is the time in milliseconds the service waits between two attempts to send the request to the other service again if no response was given.

    MaxAttempts is the maximum number of attempts. Note, that it also contains the very first call.

    With the above written default values the service tries to get a response for about 3 minutes.

    Running the server

    Prerequisites in case of microservices system mode:

    1. Config service is running

    2. Discovery service is running

    3. Gateway service is running

    Run the service in command line in folder jws/jws-taskmanager:

    jws-taskmanager-service start (on Windows)

    jws-taskmanager-service start (on Linux)

    or

    run-jws-taskmanager.exe (on Windows)

    run-jws-tarkmanager (on Linux)

    API documentation

    Find and try out the API on the Swagger UI.

    Mode URL of Swagger UI Default URL of Swagger UI
    microservices system <serverhost>:<gateway-port>/jws-taskmanager/API/ localhost:8080/jws-taskmanager/API/
    standalone web application mode <serverhost>:<server-port>/API/ localhost:8068/API/

    Demo site

    For detailed description check out the JWS Task Manager demo site:

    https://jchem-microservices.chemaxon.com/jws-taskmanager/api/index.html

    Usage

    The guidelines, examples on the Demo site or on the Swagger UI API documentation of your installed module display the methods and syntax implemented for reaching the functionalities of the Task Manager toolkit.

    Basic endpoints

    • create task (see taskId in the response)

    • add/upload molecules to the task referenced by taskId

    • manage (Start) the task referenced by taskId

    • get the results of task referenced by taskId

    All available endpoints

    • create task

    • delete task referenced by taskId

    • list all tasks

    • add structures to task referenced by taskId

    • upload structures from file to task referenced by taskId

    • modify structures referenced by structureID of a task referenced by taskId

    • remove structures referenced by structureID from task referenced by taskId

    • get structure referenced by structureID from a task referenced by taskId

    • delete structure referenced by structureID from a task referenced by taskId

    • get all structures of a task referenced by taskId

    • manage task (Start) referenced by taskId

    • get the state of a task referenced by taskId

    • get the results of a task referenced by taskId

    JWSDB tasks

    Task manager can be applied for importing structures into an already existing table. The table must be created at the endpoint /rest-v1/db/additional/createTable/{tableName} of DB Web Services.

    The structures can be added or can be uploaded from file.

    The structures will have ID data in the table. If the structures to be imported have their own IDproperty, this IDproperty can be set as ID in the table.

    Example1

    /rest-v1/work-queue/task

    
    {
      "params": {
        "tableName": "mytable"
      },
      "service": "jwsdb",
      "task": "import"
    }

    /rest-v1/work-queue/task/{taskId}

    
    {
      "inputFormat": "smiles",
      "structures": [
       "CCO"
      ]
    }

    /rest-v1/work-queue/task/{taskId}/manage

    
    {
      "action": "START"
    }

    /rest-v1/work-queue/task/{taskId}/results

    The results of the given task can be found in the file shown by the Download file link in the response.

    Example2

    /rest-v1/work-queue/task

    
    {
      "params": {
        "tableName": "mytable",
        "idProperty": "myID"
      },
      "service": "jwsdb",
      "task": "index"
    }

    /rest-v1/work-queue/task/{taskId}

    
    {
      "inputFormat": "mrv",
      "structures": [
        "<?xml version=\"1.0\" encoding=\"windows-1252\"?>\r\n<cml xmlns=\"http:\/\/www.chemaxon.com\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:schemaLocation=\"http:\/\/www.chemaxon.com\/marvin\/schema\/mrvSchema_18_11_0.xsd\" version=\"ChemAxon file format v18.11.0, generated by v19.9.0\">\r\n<MDocument>\r\n  <MChemicalStruct>\r\n    <molecule molID=\"m1\">\r\n      <propertyList>\r\n        <property dictRef=\"myID\" title=\"myID\">\r\n          <scalar>5<\/scalar>\r\n        <\/property>\r\n      <\/propertyList>\r\n      <atomArray atomID=\"a1 a2 a3 a4 a5\" elementType=\"C C C C C\" x2=\"-12.625 -13.870866329017026 -13.395003911629807 -11.854996088370193 -11.379133670982972\" y2=\"4.184992254777558 3.279775656265557 1.8152282163456634 1.8152282163456634 3.279775656265557\"\/>\r\n      <bondArray>\r\n        <bond id=\"b1\" atomRefs2=\"a1 a2\" order=\"1\"\/>\r\n        <bond id=\"b2\" atomRefs2=\"a2 a3\" order=\"1\"\/>\r\n        <bond id=\"b3\" atomRefs2=\"a3 a4\" order=\"1\"\/>\r\n        <bond id=\"b4\" atomRefs2=\"a4 a5\" order=\"1\"\/>\r\n        <bond id=\"b5\" atomRefs2=\"a1 a5\" order=\"1\"\/>\r\n      <\/bondArray>\r\n    <\/molecule>\r\n  <\/MChemicalStruct>\r\n<\/MDocument>\r\n<\/cml>"
      ]
    }

    /rest-v1/work-queue/task/{taskId}/manage

    
    {
      "action": "START"
    }

    /rest-v1/work-queue/task/{taskId}/results

    The results of the given task can be found in the file shown by the Download file link in the response.

    Example3

    /rest-v1/work-queue/task

    
    {
      "params": {
        "tableName": "mytable",
        "idProperty": "myID"
      },
      "service": "jwsdb",
      "task": "index"
    }

    /rest-v1/work-queue/task/{taskId}/upload

    Upload the the structures from file.

    /rest-v1/work-queue/task/{taskId}/manage

    
    {
      "action": "START"
    }

    /rest-v1/work-queue/task/{taskId}/results

    The results of the given task can be found in the file shown by the Download file link in the response.

    JWS-CALCULATIONS tasks

    Use similar syntax like at /rest-v1/calculator/calculate endpoint of Calculations Web Services with the exception of "structure" and "inputFormat".

    Do not add the structures to be calculated in the 'Create task' step. The structures must be added in the 'Add structures' step.

    Example1

    /rest-v1/work-queue/task

    
    {
      "params": {
        "calculations": {
          "charge": {
            "ph": 7.4
          }
        }
      },
      "service": "jws-calculations",
      "task": "charge"
    }

    /rest-v1/work-queue/task/{taskId}

    
    {
      "inputFormat": "smiles",
      "structures": [
       "CC([O-])=O"
      ]
    }

    /rest-v1/work-queue/task/{taskId}/manage

    
    {
      "action": "START"
    }

    /rest-v1/work-queue/task/{taskId}/results

    The results of the given task can be found in the file shown by the Download file link in the response.

    Example2

    /rest-v1/work-queue/task

    
    {
      "params": {
        "calculations": {
          "topology-analyser": {        
            "aliphaticRingSize": 0,
            "aromaticRingSize": 0,
            "aromatizationMethod": "GENERAL",
            "carboRingSize": 0,
            "fusedAliphaticRingSize": 0,
            "fusedAromaticRingSize": 0,
            "heteroAliphaticRingSize": 0,
            "heteroAromaticRingSize": 0,
            "heteroRingSize": 0,
            "operations": "aromaticRingCount, aromaticRings",
            "ringSize": 0,
            "ringSystemSize": 0
          },
          "charge": {
            "ph": 7.4
          }
        }
      },
      "service": "jws-calculations",
      "task": "topology-and-charge"
    }

    /rest-v1/work-queue/task/{taskId}

    
    {
      "inputFormat": "smiles",
      "structures": [
        "NC(CC1=CC=CC=C1)C(O)=O",
        "CCO"
      ]
    }

    /rest-v1/work-queue/task/{taskId}/manage

    
    {
      "action": "START"
    }

    /rest-v1/work-queue/task/{taskId}/results

    The results of the given task can be found in the file shown by the Download file link in the response.

    JWS-CHECKER-FIXER tasks

    Use similar syntax like at /rest-v1/checker-fixer/ endpoint of Structure Checker Web Services with the exception of "structure".

    Do not add the structures to be checked/fixed in the 'Create task' step. The structures must be added in the 'Add structures' step.

    Example1

    /rest-v1/work-queue/task

    
    {
      "params": {
        "exportFormat": "mrv",
        "filter": {
            "fixed": false,
            "untriggered": false
        },
        "settings": [
            {
                "checkerSettings": {
                    "checkerClass": "IncorrectTetrahedralStereoChecker",
                    "displayName": "MyStructureChecker"
                }
            }
      ]
    },
      "service": "jws-checker-fixer",
      "task": "incorrecttetrahedral"
    }

    /rest-v1/work-queue/task/{taskId}

    
    {
      "inputFormat": "mrv",
      "structures": [
        "<?xml version=\"1.0\" encoding=\"windows-1252\"?>\r\n<cml xmlns=\"http:\/\/www.chemaxon.com\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:schemaLocation=\"http:\/\/www.chemaxon.com\/marvin\/schema\/mrvSchema_18_11_0.xsd\" version=\"ChemAxon file format v18.11.0, generated by v19.9.0\">\r\n<MDocument>\r\n  <MChemicalStruct>\r\n    <molecule molID=\"m1\">\r\n      <atomArray atomID=\"a1 a2 a3 a4 a5 a6\" elementType=\"N C C O C C\" x2=\"-8.125 -6.752849952749914 -6.672252580135781 -5.461297278113961 -8.044402627385868 -5.300102532885694\" y2=\"3.0833332538604736 2.3841878842615714 0.8462984007395276 3.222931998184713 1.54544377033843 0.14715303114062528\"\/>\r\n      <bondArray>\r\n        <bond id=\"b1\" atomRefs2=\"a2 a1\" order=\"1\">\r\n          <bondStereo>W<\/bondStereo>\r\n        <\/bond>\r\n        <bond id=\"b2\" atomRefs2=\"a2 a3\" order=\"1\"\/>\r\n        <bond id=\"b3\" atomRefs2=\"a2 a4\" order=\"1\">\r\n          <bondStereo>W<\/bondStereo>\r\n        <\/bond>\r\n        <bond id=\"b4\" atomRefs2=\"a2 a5\" order=\"1\"\/>\r\n        <bond id=\"b5\" atomRefs2=\"a3 a6\" order=\"1\"\/>\r\n      <\/bondArray>\r\n    <\/molecule>\r\n  <\/MChemicalStruct>\r\n<\/MDocument>\r\n<\/cml>"
      ]
    }

    /rest-v1/work-queue/task/{taskId}/manage

    
    {
      "action": "START"
    }

    /rest-v1/work-queue/task/{taskId}/results

    The results of the given task can be found in the file shown by the Download file link in the response.

    Example2

    /rest-v1/work-queue/task

    
    {
    "params": {
      "exportFormat": "mrv",
      "filter": {
        "fixed": false,
        "untriggered": false
      },
      "settings": [
        {
          "checkerSettings": {
            "checkerClass": "MissingAtomMapChecker"
          },
          "fixerSettings": {
            "exportFormat": "mrv",
            "fixerClass": "MapMoleculeFixer"
          }
        }
      ]
    },
      "service": "jws-checker-fixer",
      "task": "checker-fixer"
    }

    /rest-v1/work-queue/task/{taskId}

    
    {
      "inputFormat": "mrv",
      "structures": [
        "<?xml version=\"1.0\" encoding=\"windows-1252\"?>\r\n<cml xmlns=\"http:\/\/www.chemaxon.com\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:schemaLocation=\"http:\/\/www.chemaxon.com\/marvin\/schema\/mrvSchema_18_11_0.xsd\" version=\"ChemAxon file format v18.11.0, generated by v19.9.0\">\r\n<MDocument>\r\n  <MChemicalStruct>\r\n    <molecule molID=\"m1\">\r\n      <atomArray atomID=\"a1 a2 a3 a4 a5 a6\" elementType=\"C C C C C C\" mrvMap=\"1 2 0 0 0 3\" x2=\"-8.666666984558105 -10.000336325606362 -10.000336325606362 -8.666666984558105 -7.332997643509847 -7.332997643509847\" y2=\"3.9983671349785546 3.228350194419514 1.6883163133014332 0.9182993727423927 1.6883163133014332 3.228350194419514\"\/>\r\n      <bondArray>\r\n        <bond id=\"b1\" atomRefs2=\"a1 a2\" order=\"1\"\/>\r\n        <bond id=\"b2\" atomRefs2=\"a2 a3\" order=\"1\"\/>\r\n        <bond id=\"b3\" atomRefs2=\"a3 a4\" order=\"1\"\/>\r\n        <bond id=\"b4\" atomRefs2=\"a4 a5\" order=\"1\"\/>\r\n        <bond id=\"b5\" atomRefs2=\"a5 a6\" order=\"1\"\/>\r\n        <bond id=\"b6\" atomRefs2=\"a1 a6\" order=\"1\"\/>\r\n      <\/bondArray>\r\n    <\/molecule>\r\n  <\/MChemicalStruct>\r\n<\/MDocument>\r\n<\/cml>"
      ]
    }

    /rest-v1/work-queue/task/{taskId}/manage

    
    {
      "action": "START"
    }

    /rest-v1/work-queue/task/{taskId}/results

    The results of the given task can be found in the file shown by the Download file link in the response.