Skip to content

Commit

Permalink
Add task_name to built-in variables
Browse files Browse the repository at this point in the history
  • Loading branch information
komamitsu committed Apr 6, 2017
1 parent 866196d commit 58e06fe
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
Expand Up @@ -71,6 +71,9 @@ public static Config buildRuntimeParams(ConfigFactory cf, TaskRequest request)

params.set("retry_attempt_name", request.getRetryAttemptName().orNull());

// task_*
params.set("task_name", request.getTaskName());

return params;
}

Expand Down
1 change: 1 addition & 0 deletions digdag-docs/src/workflow_definition.rst
Expand Up @@ -63,6 +63,7 @@ Name Description Exam
**session_local_time** Local time format of session_time 2016-01-30 00:00:00
**session_tz_offset** Time zone offset part of session_time -0800
**session_unixtime** Seconds since the epoch time 1454140800
**task_name** Name of this task +my_workflow+parent_task+child_task0
=============================== =========================================== ==========================

If `schedule: option is set <scheduling_workflow.html>`_, **last_session_time** and **next_session_time** are also available as following:
Expand Down
Expand Up @@ -73,6 +73,7 @@ public void testRun()
.put("next_session_local_time", is("2016-01-03 00:00:00"))
.put("next_session_tz_offset", is("+0000"))
.put("next_session_unixtime", is("1451779200"))
.put("task_name", is("+built_in_variables+get_variables+task_name"))
.build();

assertThat(values.entrySet().size(), is(expectedOutput.size()));
Expand Down
Expand Up @@ -50,3 +50,5 @@ schedule:
sh>: "echo next_session_tz_offset: \\'${next_session_tz_offset}\\' >> output.yml"
+next_session_unixtime:
sh>: "echo next_session_unixtime: \\'${next_session_unixtime}\\' >> output.yml"
+task_name:
sh>: "echo task_name: \\'${task_name}\\' >> output.yml"

0 comments on commit 58e06fe

Please sign in to comment.