Danny,

thanks. I've followed your example.  Adapting it slightly as to use my
doistats-database, but keeping your sample script, I get the same
results as you do, same results for the manual spawn in cq.

2009-08-11 00:40:00.739 Info: TaskServer: hello
2009-08-11 00:42:48.269 Info: TaskServer: hello

I've just spawned my own task in cq and it works, the queue of the
task server is full.  I've recreated the task to run in 10 minutes'
time (i.e. at one o'clock in the morning), we'll see what that does.

Maybe I should add at this point that the update.xqy spawns itself a
big number of tasks, like this:

for $doi in cts:element-values(xs:QName("DOI"))
return
    <div>
    {
        try {
            xdmp:spawn(
                "/app/backend/query-doi.xqy",
                (xs:QName("doi"), $doi,
                 xs:QName("date"), $date) (: corresponds to fn:current-date() :)
            )
        } catch($e) {
          <i xmlns:e="http://marklogic.com/xdmp/error";>OOPS {$doi}:
{$e/e:message/text()}</i>
        }
    }
    </div>


thanks for your help so far,
Jakob.




On Mon, Aug 10, 2009 at 23:49, Danny
Sokolsky<[email protected]> wrote:
> Hi Jakob,
>
> The root is just the root from which to evaluate the path.  This is just like 
> the root option to xdmp:spawn.  The path is then relative to the root.  So if 
> your root is /foo/ and your path is hello.xqy, then it will resolve to 
> /foo/hello.xqy.
>
> It looks like things are configured correctly in your system, but it is easy 
> to accidentally overlook something. Is it possible you added that module to a 
> different database?
>
> Here is what I tried successfully:
>
> 1) create a text file that is an xquery main module.  I created mine in the 
> database names "Modules":
>
> xdmp:document-insert("/test/test.xqy", text {"xdmp:log('hello')"})
>
> 2) configure a scheduled task.  Mine has these setting:
>
> task path       /test/test.xqy
> task root       /
> task type       daily
> task period     1
> task start time         2:12 PM
> task database   Modules
> task modules    Modules
> task user       admin
> task host       server-name.marklogic.com
>
> At 2:12 I saw the following in my ErrorLog.txt:
>
> 2009-08-10 14:12:00.532 Info: TaskServer: hello
>
> 3) Test my module in cq as follows:
>
> xquery version "1.0-ml";
> xdmp:spawn("/test/test.xqy", (),
>  <options xmlns="xdmp:eval">
>          <modules>{xdmp:database("Modules")}</modules>
>          <root>/</root>
>         </options>)
>
> I see the following in my log:
>
> 2009-08-10 14:18:41.499 Info: TaskServer: hello
>
> Maybe if you can try something like that, then compare the process with what 
> you are doing, it will help find the solution?
>
> -Danny
>
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Jakob Fix
> Sent: Monday, August 10, 2009 1:54 PM
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] scheduled task (task root?)
>
> Hi Danny,
>
> thanks for answering. please see my comments inline.
>
> On Mon, Aug 10, 2009 at 19:03, Danny Sokolsky
> <[email protected]> wrote:
>>
>> Hi Jakob,
>>
>> Debugging things on the task server can be a little tricky...
>>
>> When you say manually it works, what do you mean?  If you do an:
>>
>> xdmp:invoke("/app/backend/update.xqy") it works?
>
> yes, it does.
>
>> The exception you are seeing can happen if the document 
>> /app/backend/update.xqy is not loaded as a text document, or if the document 
>> cannot be found (or if there is a permission issue causing it not to be 
>> found, but since you are running as admin that should not be the 
>> case--assuming your admin user has the admin role).  So the first thing to 
>> verify is that the doistats-database database has the app/backend/update.xqy 
>> document loaded as a text file.
>>
>> For example, if you load a main module as follows, then you can confirm it 
>> is a text document as follows:
>>
>> xdmp:document-insert("/test/test.xqy", text {"'hello'"}) ;
>>
>> if ( doc("/test/test.xqy")/node()
>>       instance of text() )
>> then "text"
>> else "not text"
>
> doing this for my xquery file returns, as hoped for, "text".
>
>> And yes, to change a scheduled task you must delete it and then recreate it.
>
> yes, this has become an RFE, it seems. :)
>
> so, does this mean, on paper everything works as it should?  what's
> the next step to test?  could you explain the idea behind the task
> root property, I haven't grasped it so far.
>
>> -Danny
>
> thanks,
> Jakob.
>
>
>> -----Original Message-----
>> From: [email protected] 
>> [mailto:[email protected]] On Behalf Of Jakob Fix
>> Sent: Monday, August 10, 2009 3:09 AM
>> To: General Mark Logic Developer Discussion
>> Subject: [MarkLogic Dev General] scheduled task (task root?)
>>
>> I've created a scheduled task in MLS 4.1.  It does not run:
>>
>> not with "/" as the task root
>> 2009-08-08 21:32:00.106 Notice: TaskServer: XDMP-TEXTNODE:
>> /app/backend/upate.xqy -- Server unable to build program from non-text
>> document
>> 2009-08-08 21:32:00.106 Notice: TaskServer: in /app/backend/upate.xqy 
>> [1.0-ml]
>>
>> nor with "http://server:8004/";
>> 2009-08-10 12:00:00.050 Notice: TaskServer: XDMP-TEXTNODE:
>> http://server:8004/app/backend/update.xqy -- Server unable to build
>> program from non-text document
>> 2009-08-10 12:00:00.050 Notice: TaskServer: in /app/backend/update.xqy 
>> [1.0-ml]
>>
>> manually, it works (of course).
>>
>> I have searched the marklogic mailing list for discussions with this
>> kind of problem and only found one message from May 2008 which had
>> encountered this type of exception
>> (http://markmail.org/thread/nk26f2eizhqy3scy).  In my case, it seems
>> to be a problem with the "task root" property of the scheduled task
>> which is explained in the help as follows:
>>
>> "task root specifies the root directory (files [sic] system) or URI
>> root (database) that contains the module."
>>
>> I'm in the latter case where the xquery sits in the
>> "doistats-database" database in the /app/backend/ directory.  Or could
>> the problem lie somewhere else (permissions? I'm running this as admin
>> with all privileges)?
>>
>> here are the task details:
>>
>> task path: /app/backend/update.xqy
>> task root: /
>> task type: daily
>> task period: 1
>> task start time 9:32 PM
>> task database: doistats-database
>> task modules: doistats-database
>> task user: admin
>> task host: server
>>
>>
>> BTW, it seems a scheduled task cannot be modified, but only deleted?
>> (I filed a case with support@).
>>
>> thanks,
>> Jakob.
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://xqzone.com/mailman/listinfo/general
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to