Class: OdpsDatahub::XmlTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/odps/xml_template.rb

Class Method Summary collapse

Class Method Details

.getJobXml(name, comment, priority, taskStr, runMode) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/fluent/plugin/odps/xml_template.rb', line 39

def self.getJobXml(name, comment, priority, taskStr, runMode)
  job_template=%{<?xml version="1.0" encoding="utf-8"?>
    <Instance>
    <Job>
      <Name>#{name}</Name>
      <Comment>#{comment}</Comment>
      <Priority>#{priority}</Priority>
      <Tasks>
         #{taskStr}
      </Tasks>
      <DAG>
        <RunMode>#{runMode}</RunMode>
      </DAG>
    </Job>
    </Instance>}
  return job_template
end

.getTaskXml(taskName, sqlString) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fluent/plugin/odps/xml_template.rb', line 23

def self.getTaskXml(taskName, sqlString)
  task_template=%{<SQL>
    <Name>#{taskName}</Name>
    <Comment/>
    <Config>
      <Property>
        <Name>settings</Name>
        <Value>{"odps.sql.udf.strict.mode": "true"}</Value>
      </Property>
    </Config>
    <Query><![CDATA[#{sqlString}]]></Query>
  </SQL>
  }
  return task_template
end