Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-2992

Search processors to get image, table, or json from an external task

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: SUIT
    • Labels:
      None

      Description

      Implement three search processors, which use the External Task Launcher (DM-2991):

      • to get a table (possibly in binary FITS format)
      • to get an image
      • to get JSON

        Attachments

          Issue Links

            Activity

            Hide
            tatianag Tatiana Goldina added a comment -

            1. To load a table using Firefly Javascript API:

            function onFireflyLoaded() {
            var tableData= { "processor" : "TableFromExternalTask",
            "launcher" : "python",
            "task" : "TestTask3",
            "taskParams" :

            { "param1" : "str +1", "param2" : "str +2" }

            };
            firefly.showTable(tableData, "tableHere");
            }

            (I do understand that showTable JS interface function needs some work to call the required search processor directly and to give and option to cache the results. Currently the results are never cached: the timestamp is added too the request.)

            2. To load FITS image using Firefly javascript API:

            function onFireflyLoaded() {
            var iv2= firefly.makeImageViewer("plot");
            iv2.plot({
            "id" :"FileFromExternalTask",
            "launcher" :"python",
            "task" :"someImageTask",
            "taskParams" :

            {"p1":1,"p2":2}

            ,
            "Title" :"Example FITS Image'",
            "ColorTable" :"16",
            "RangeValues":firefly.serializeRangeValues("Sigma",-2,8,"Linear")});
            }

            3. To get JSON results from Firefly javascript code:

            import

            {ServerRequest}

            from 'ipac-firefly/data/ServerRequest.js';
            import

            {getJsonData}

            from 'ipac-firefly/rpc/SearchServicesJson.js';

            given JSON task paramers like
            taskParams :

            { p1:'one', p2:'two' }

            let req = new ServerRequest('JsonFromExternalTask');
            req.setParam(

            {name : 'launcher', value : 'python'}

            );
            req.setParam(

            {name : 'task', value : 'JsonTask'}

            );
            req.setParam(

            {name : 'taskParams', value : JSON.stringify(taskParams)}

            );
            return getJsonData(req);

            Show
            tatianag Tatiana Goldina added a comment - 1. To load a table using Firefly Javascript API: function onFireflyLoaded() { var tableData= { "processor" : "TableFromExternalTask", "launcher" : "python", "task" : "TestTask3", "taskParams" : { "param1" : "str +1", "param2" : "str +2" } }; firefly.showTable(tableData, "tableHere"); } (I do understand that showTable JS interface function needs some work to call the required search processor directly and to give and option to cache the results. Currently the results are never cached: the timestamp is added too the request.) 2. To load FITS image using Firefly javascript API: function onFireflyLoaded() { var iv2= firefly.makeImageViewer("plot"); iv2.plot({ "id" :"FileFromExternalTask", "launcher" :"python", "task" :"someImageTask", "taskParams" : {"p1":1,"p2":2} , "Title" :"Example FITS Image'", "ColorTable" :"16", "RangeValues":firefly.serializeRangeValues("Sigma",-2,8,"Linear")}); } 3. To get JSON results from Firefly javascript code: import {ServerRequest} from 'ipac-firefly/data/ServerRequest.js'; import {getJsonData} from 'ipac-firefly/rpc/SearchServicesJson.js'; given JSON task paramers like taskParams : { p1:'one', p2:'two' } let req = new ServerRequest('JsonFromExternalTask'); req.setParam( {name : 'launcher', value : 'python'} ); req.setParam( {name : 'task', value : 'JsonTask'} ); req.setParam( {name : 'taskParams', value : JSON.stringify(taskParams)} ); return getJsonData(req);

              People

              • Assignee:
                tatianag Tatiana Goldina
                Reporter:
                tatianag Tatiana Goldina
                Watchers:
                Tatiana Goldina
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: