Skip to content

Fix gradle task name conflict ('run' to 'runLuke')#479

Closed
mocobeta wants to merge 1 commit intoapache:mainfrom
mocobeta:fix-task-name-conflict
Closed

Fix gradle task name conflict ('run' to 'runLuke')#479
mocobeta wants to merge 1 commit intoapache:mainfrom
mocobeta:fix-task-name-conflict

Conversation

@mocobeta
Copy link
Copy Markdown
Contributor

There are two Gradle tasks named "run": the one is defined in the "benchmark" project, and another one is in the "luke" project.

gradlew tasks shows:

Utility launchers tasks
-----------------------
run - Launches (spawns) Luke directly from the build process.

When I run gradlew run, this actually invokes the run task that belongs to "benchmark" (and fails).

> Task :lucene:benchmark:run FAILED
Running algorithm from: /mnt/hdd/repo/lucene/lucene/benchmark/conf/micro-standard.alg
------------> config properties:
analyzer = org.apache.lucene.analysis.standard.StandardAnalyzer
compound = true
content.source = org.apache.lucene.benchmark.byTask.feeds.ReutersContentSource
directory = FSDirectory
doc.stored = true
doc.term.vector = false
doc.tokenized = true
docs.dir = reuters21578
log.queries = true
log.step = 500
max.buffered = buf:10:10:100:100
merge.factor = mrg:10:100:10:100
query.maker = org.apache.lucene.benchmark.byTask.feeds.ReutersQueryMaker
task.max.depth.log = 2
work.dir = data
-------------------------------
java.lang.RuntimeException: java.nio.file.NoSuchFileException: data/reuters21578
        at org.apache.lucene.benchmark.byTask.feeds.ReutersContentSource.setConfig(ReutersContentSource.java:70)
        at org.apache.lucene.benchmark.byTask.PerfRunData.<init>(PerfRunData.java:126)
        at org.apache.lucene.benchmark.byTask.Benchmark.<init>(Benchmark.java:57)
        at org.apache.lucene.benchmark.byTask.Benchmark.exec(Benchmark.java:113)
        at org.apache.lucene.benchmark.byTask.Benchmark.main(Benchmark.java:87)

This quick-fix resolves the naming conflict. There could be a proper way to handle such conflicts, though.

./gradlew tasks

Utility launchers tasks
-----------------------
runLuke - Launches (spawns) Luke directly from the build process.

To avoid a too generic name for each task seems to be a good practice.
https://discuss.gradle.org/t/what-occur-on-a-task-name-conflict/11693

@mocobeta mocobeta requested a review from dweiss November 27, 2021 05:01
@dweiss
Copy link
Copy Markdown
Contributor

dweiss commented Nov 27, 2021

This is not a bug, actually. If you run gradlew run, it'll run that task in all of the submodules that contain it. You should scope the invocation: gradlew :lucene:luke:run or gradlew -p lucene/luke run.

I don't think these have to be made unique (a description of the 'run' task should be added to benchmarks).

@mocobeta
Copy link
Copy Markdown
Contributor Author

Yes, I've always run gradlew -p lucene/luke run.
(While it isn't a bug, it could be a bit puzzling since there is no mention about "run" task for "benchmark" project, also two "run" tasks are very different unlike other common tasks such as "test").

@mocobeta mocobeta closed this Nov 27, 2021
@mocobeta mocobeta deleted the fix-task-name-conflict branch December 6, 2021 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants