how to set IMatch processRun without timeout

Started by helen, May 08, 2018, 01:59:23 AM

Previous topic - Next topic

helen

Hi Mario,

Currently, I added a button in IMatch script to trigger my external program (which is `.exe`). However, I don want the timeout when I run my external program. Do you have any suggestion for my case? how to set the parameter `timeout`?
my code is below:


$('#btn-python-category').click(function() {
                    $('#result').text('');
                    showAnimation(true);
                    IMatch.processRun({
                        'executable' : 'C:\\Users\\heh\\work\\herbrecs\\imatch\\dist\\create_category\\create_category.exe',
                        'verb' : 'open',
                        'parameters' : '',
                        'showwindow' : true,
                        'timeout' : '1000'
                    }).then(function(response) {
                        showAnimation(false);
                        if (response.result === 'ok' && response.exitCode === 0) {
                            $('#result').text(response.output);
                        }
                        else {
                            $('#result').text(response.errorOutput);                         
                        }
                    },
                    function(error){
                         console.log(error);
                         showAnimation(false);
                         result.text(error.responseText);
                     });
                });


Thanks for all your help.

Kind Regards,
Helen

Mario

The timeout parameter controls how long IMatch waits for the spawned process to finish.
In your case it should wait up to 1000 seconds. What exactly is the problem?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

helen

#2
Hi Mario,

In my understanding, 1000 seconds is the max time that IMatch allows my program to run. if my external program runs out of 1000 seconds, the IMatch will shutdown my program automatically. is my understanding correct? if yes, i want to remove this time limitation in IMatch.

Thanks :)

My another question is about the IMatch API which retrieves attributes of image. My code is below:

try:
        req = requests.get(HOST_URL + '/v1/attributes', params={
           'auth_token': auth_token,
           'idlist': '@imatch.filewindow.active.selection',
           'set': 'Image',
           'attributes': 'Taxon'
        }, timeout=REQUEST_TIMEOUT)

        data = req.json()
       
        image_taxons = {img['id']: img['data'][0]['Taxon'] for img in data['result']}
        print(image_taxons)


I have 2 IMatch databases which point to the same image file folder and have the same attribute set. Then, I selected the same image in both databases and run this piece of code to retrieve the attribute value, however it returned different data format. For example, i tried to retrieve the `Taxon` attribute of image `71328` and the `Taxon` attribute is empty :
database A return : {} --empty dic
database B return : {71382:''} --has the record which `Taxon`is empty string


I want to know why it returns different format. There must be some different setting between 2 databases..

Kind Regards,
Helen

Mario

Use a larger timeout value if you need to run tasks which run for so long (not a really good idea, 1000s is already a lot).

It's hard to tell why you get other results for your Attributes.
Same file selected? Same data for that file in both databases?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook