Marklogic 8 - 计划任务错误 err:FOTY0013 无法原子化函数

Marklogic 8 - a schedule task error err:FOTY0013 Functions cannot be atomized

查询在 qconsole 上成功运行。但是设置一个计划任务。它会排除错误 err:FOTY0013 函数无法原子化...

import module namespace json="http://marklogic.com/xdmp/json" at 
 "/MarkLogic/json/json.xqy";

  xdmp:set-request-time-limit(3600),
  let $custom :=
  let $config := json:config("custom")
  let $_ := map:put($config,"whitespace","ignore")
  let $_ := map:put($config,"array-element-names","TR")
  return $config
  let $res := cts:uris(..code..)
 for $uri in $res
 (..code..)
 let $_ := if(xdmp:filesystem-file-exists($dirPath))
    then ()
    else xdmp:filesystem-directory-create(
        $dirPath,
        <options xmlns="xdmp:filesystem-directory-create">
            <create-parents>true</create-parents>
        </options>
    )
let $_ := xdmp:save(
    fn:concat($dirPath,$accStr,".json"),
    json:transform-to-json(fn:doc($uri),$custom)
)

在计划任务中假脱机错误err:FOTY0013函数无法原子化...

2019-01-03 13:52:00.180 Notice: TaskServer:   $custom = map:map(<map:map 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>...XDMP-ATOMIZEFUNC: 
(err:FOTY0013) Functions cannot be atomized...)
2019-01-03 13:52:00.180 Notice: TaskServer:   $dtfmt = "20190103"
2019-01-03 13:52:00.180 Notice: TaskServer:   $sdate1 = "2018-12- 
27T13:52:00.175667-05:00"

如果没有更多信息(例如最小的可重现的完整示例),很难说清楚。 您可以尝试在序言中添加 XQuery 版本以强制您的 QCOnsole 代码和任务代码为 运行 相同的 xquery 版本,我相信默认值是不同的。

XDMP-ATOMIZEFUNC 可能在生成错误日志消息时发生,因为它试图生成错误消息并序列化变量的内容,或者包含函数。 $json:config 有几个函数属性,它无法原子化 $json:config 以在错误日志消息中打印出该变量的内容,正如您所看到的,它已经为 $dtfmt$sdate1 变量。

Atomization

The result of atomization is either a sequence of atomic values or a type error [err:FOTY0012].

Definition: Atomization of a sequence is defined as the result of invoking the fn:data function on the sequence, as defined in [XQuery 1.0 and XPath 2.0 Functions and Operators (Second Edition)].

您可以通过在 QConsole 中执行此代码观察到相同的错误:

xquery version "1.0-ml";
import module namespace json="http://marklogic.com/xdmp/json" at 
 "/MarkLogic/json/json.xqy";

let $custom :=
  let $config := json:config("custom")
  let $_ := map:put($config,"whitespace","ignore")
  let $_ := map:put($config,"array-element-names","TR")
  return $config

return $custom

您没有提供足够的代码或错误消息来确定,但 XDMP-ATOMIZEFUNC 不太可能是您问题的根本原因。在错误日志中进一步查找异常的开始,以查看真正的错误是什么。它应该有模块和行号。