5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

digdagのtd>のdownload_file

Last updated at Posted at 2016-10-25

MalformedInputExceptionになることがある → 0.8.19で解消済

digdag(執筆当時0.8.16くらいだったか)のtd>:にdownload_file:を指定すると、うまくいく場合と以下のエラーでうまくいかない場合がある
データによるっぽい?

    java.nio.charset.MalformedInputException: Input length = 1
org.msgpack.core.MessageStringCodingException: java.nio.charset.MalformedInputException: Input length = 1
       at org.msgpack.value.impl.AbstractImmutableRawValue.asString(AbstractImmutableRawValue.java:72)
       at io.digdag.standards.operator.td.TdOperatorFactory.addCsvValue(TdOperatorFactory.java:390)
       at io.digdag.standards.operator.td.TdOperatorFactory.addCsvRow(TdOperatorFactory.java:334)
       at io.digdag.standards.operator.td.TdOperatorFactory.lambda$downloadJobResult$0(TdOperatorFactory.java:304)
       at io.digdag.standards.operator.td.TDJobOperator.lambda$null$3(TDJobOperator.java:105)
       at com.treasuredata.client.TDHttpClient.call(TDHttpClient.java:442)
       at com.treasuredata.client.TDClient.jobResult(TDClient.java:597)
       at io.digdag.standards.operator.td.TDJobOperator.lambda$getResult$4(TDJobOperator.java:103)
       at io.digdag.util.RetryExecutor.run(RetryExecutor.java:158)
       at io.digdag.util.RetryExecutor.run(RetryExecutor.java:133)
       at io.digdag.standards.operator.td.TDJobOperator.getResult(TDJobOperator.java:102)
       at io.digdag.standards.operator.td.TdOperatorFactory.downloadJobResult(TdOperatorFactory.java:299)
       at io.digdag.standards.operator.td.TdOperatorFactory$TdOperator.processJobResult(TdOperatorFactory.java:124)
       at io.digdag.standards.operator.td.BaseTdJobOperator.runTask(BaseTdJobOperator.java:57)
       at io.digdag.util.BaseOperator.run(BaseOperator.java:51)
       at io.digdag.core.agent.OperatorManager.callExecutor(OperatorManager.java:297)
       at io.digdag.cli.Run$OperatorManagerWithSkip.callExecutor(Run.java:676)
       at io.digdag.core.agent.OperatorManager.runWithWorkspace(OperatorManager.java:241)
       at io.digdag.core.agent.OperatorManager.lambda$runWithHeartbeat$2(OperatorManager.java:134)
       at io.digdag.core.agent.NoopWorkspaceManager.withExtractedArchive(NoopWorkspaceManager.java:20)
       at io.digdag.core.agent.OperatorManager.runWithHeartbeat(OperatorManager.java:132)
       at io.digdag.core.agent.OperatorManager.run(OperatorManager.java:116)
       at io.digdag.cli.Run$OperatorManagerWithSkip.run(Run.java:658)

起きたときには以下で回避(★)

+step1:
  td>: XXX.sql
# download_file: XXX.csv
+step2:
  sh>: td job:show ${td.last_job_id} -f csv -o XXX.csv --column-header

2016/11/17追記:ver.0.8.19で解消済とのこと(試していないが) → http://docs.digdag.io/releases/release-0.8.19.html#workflow-changes

サーバモードだと次タスクで読めない

カレントディレクトリにダウンロードするので、ローカルモードなら次タスクで読める
しかしサーバモードだとタスク毎に専用ディレクトリが作られてその中で当該タスクが実行されて当該タスクが終わると当該ディレクトリは消えるのでダウンロードしたファイルを次タスクで読むことはできない
かといって「download_file: /tmp/XXX.csv」とか「download_file: ../XXX.csv」とか指定すると「プロジェクトディレクトリ外は指定不可」エラーになる

しかたないので前述の★で回避 (-o /tmp/XXX.csv)

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?