'Task'에 해당되는 글 3건

  1. 2020.04.20 [Gradle] Task Tutorial
  2. 2020.04.17 [Gradle] Task Zip
  3. 2014.07.25 [Hadoop] map task 정의.

[Gradle] Task Tutorial

ITWeb/개발일반 2020. 4. 20. 10:34

Gradle 을 이용한 build.gradle 작성 시 튜토리얼을 한번 보고 해보면 좋습니다.

 

[공식문서]

https://docs.gradle.org/current/userguide/tutorial_using_tasks.html

https://docs.gradle.org/current/dsl/org.gradle.api.Task.html

 

Task 의 실행 단계는 

- Task 본문의 Configuration

- doFirst

- doLast

단계로 실행 됩니다.

 

이 실행 단계를 이해 하기 위해서는 아래 문서를 참고 하세요.

 

[공식문서]

https://docs.gradle.org/current/userguide/build_lifecycle.html

Initialization

Gradle supports single and multi-project builds. 
During the initialization phase, Gradle determines 
which projects are going to take part in the build, 
and creates a Project instance for each of these projects.

Configuration

During this phase the project objects are configured. 
The build scripts of all projects which are part of the build are executed.

Execution

Gradle determines the subset of the tasks, 
created and configured during the configuration phase, to be executed. 
The subset is determined by the task name arguments passed to the gradle command 
and the current directory. 
Gradle then executes each of the selected tasks.

settings.gradle > build.gradle > task configured > task internal configuration > task

 

더불어서 task 가 실행 되지 않는 경우가 있는데 이 경우는 아래의 경우 실행 되지 않습니다.

 

- SKIPPED

Task did not execute its actions.

- NO-SOURCE

Task did not need to execute its actions.

  • Task has inputs and outputs, but no sources. For example, source files are .java files for JavaCompile.

:

[Gradle] Task Zip

ITWeb/개발일반 2020. 4. 17. 10:13

참고문서)

https://docs.gradle.org/current/userguide/working_with_files.html#sec:creating_archives_examplel

 

예제) build.gradle

plugins {
  id 'base'
}

def buildNumber = System.getenv('BUILD_NUMBER')
version = "0.0.${buildNumber}"

task packageDistribution(type: Zip) {
  archiveFileName = "${project.name}-${project.version}.zip"
  destinationDirectory = file("$buildDir/dist")

  from 'docker-compose', 'scripts'
}

 

:

[Hadoop] map task 정의.

ITWeb/스크랩 2014. 7. 25. 04:44

원문 : http://xlos.tistory.com/1512


정보 공유 차원에서 오늘 한 삽질을 기록으로 남김

  1. 상황
    • map/reduce 프레임웍이 필요한 것은 아니고, 단순하지만 처리하는데 오래 걸리는 작업들을 여러 컴퓨터에 분산하여 처리하고자 함.
    • reduce task 개수를 0으로 주고 mapper only로 설정하여 작업을 시작.
    • 문제 : 현재 hadoop의 scheduler는 preemptive 하지 않기 때문에, 한 번 map task가 시작되면, priority가 낮더라도 해당 map task가 끝날 때 까지 계속 진행됨. 덕분에 나의 단순하고 오래 걸리는 작업들이 한 번 hadoop에서 돌기 시작하면, 다른 긴급한 작업들이 처리되지 못하는 상황이 발생!
    • 시도된 해결책
      • 나의 job에서 동시에 실행되는 map task 개수를 제한하여, 다른 긴급한 작업들이 처리될 수 있도록 함
  2. 삽질.. 삽질..
    • 첫 번째 시도 : mapred.jobtracker.maxtasks.per.job=10 으로 설정
      • 하나의 job 당 최대 task 수를 10으로 설정했으니, 한 번에 실행되는 map task의 수도 제한되지 않을까? 라고 생각했으나,, 실제로는 적용 안됨. ㅜ.ㅜ
    • 두 번 째 시도 : mapred.tasktracker.map.tasks.maximum=1 로 설정
      • 이 설정의 의미는 하나의 task tracker에 의해 동시에 실행되는 map task의 개수
      • 저렇게 설정하면, 하나의 task tracker에 의해서 하나의 map task만 실행되어야 한다. 하지만 실제로는 적용이 안됨.
      • 이 부분에 대해서는 원인을 찾았는데, Hadoop The Definitive Guide라는 책에 보면 아래와 같이 쓰여 있다.
      • Be aware that some properties have no effect when set in the client configuration. For example, if in your job submission you set mapred.tasktracker.map.tasks.maximum with the expectation that it would change the number of task slots for the tasktrackers running your job then you would be disappointed, since this property only is only honored if set in the tasktracker’s mapred-site.html file.

      • 해석하면, mapred.tasktracker.~ 로 실행되는 설정들은 tasktracker daemon에 의해서만 적용되며, client에서 설정한 값은 무시 된다는 말씀.
    • 세 번째 시도 : mapred.map.tasks=10 으로 설정!
      • mapred.map.tasks 설정은 하나의 job 당 map task 의 개수이므로, map task의 개수가 적으면 당연히 동시에 실행되는 map task의 개수도 제한 될 것이라고 생각했지만!! 여전히 적용 안됨.
      • 원인을 찾아본 결과, mapred.map.tasks는 map task의 개수는 늘릴 수 있지만, 하둡이 결정한 map task의 개수 이하로는 줄일 수 없다고 함. 출처 :http://wiki.apache.org/hadoop/HowManyMapsAndReduces
      • 참고로 하둡은 하나의 input split 당 하나의 map task를 생성함. input split이란, 각 input file들을 구성하고 있는 하나 하나의 data block을 뜻함.
    • 발상의 전환 : 굳이 한 번에 실행되는 map task의 개수를 줄일 필요가 있을까?
      • 문제가 되는 상황은 나의 job이 모든 map task slot을 점유하고, 다른 긴급한 job들이 나의 slot을 뺏을 수 없어서 생기는 문제.
      • 그렇다면, 하나의 map task 가 빨리 빨리 종료되도록 단위를 줄이면, 그 사이 다른 priority 가 높은 job들이 종료된 map slot을 차지하여, map task을 실행시킬 수 있게 되어, priority가 역전되는 문제를 회피할 수 있음.
      • map task를 얼마나 늘려야 할까? 심플하게 mapred.map.tasks=100000000 정도로 설정하면, 하나의 map task가 처리하는 단위가 작아지고, 굉장히 빠른 시간에 종료되므로, preemptive 문제는 해결할 수 있지만, 이 경우, input split이 너무 작아질 수 있기 때문에, hadoop에서 배보다 배꼽이 더 큰 상황이 발생할 수 있다.
      • 이때 구세주처럼 등장한 설정이 있으니 바로 mapred.min.split.size ! 하나의 input split의 최소 단위를 설정할 수 있는데, 이 설정을 이용하면, map task가 지나치게 많아지는 것을 방지할 수 있다.
      • 최종 해결책
        • mapred.min.split.size=4194304  (하나의 input split은 최소 4MB 단위로 처리해라)
        • mapred.map.tasks=1000000   (최대한 map task를 잘게 쪼개서, 다른 작업에 방해가 되지 않도록 하자)
        • 실제로 위와 같이 설정하면, 전체 map task가 백 만 개 이하로 적절하게 쪼개져서 동작함. (몇 개로 쪼개지는 지는 전체 input file의 size에 따라 다름)


: