Error in running movie recommendations by using Apache Mahout with HDInsight

 ̄綄美尐妖づ 提交于 2020-01-16 19:40:14

问题


I ran the following code but receiving an error...

# The HDInsight cluster name.
$clusterName = "my-cluster-name"

Use-AzureHDInsightCluster $clusterName

# NOTE: The version number portion of the file path
# may change in future versions of HDInsight.
# So dynamically grab it using Hive.
$mahoutPath = Invoke-Hive -Query '!${env:COMSPEC} /c dir /b /s ${env:MAHOUT_HOME}\examples\target\*-job.jar' | where {$_.startswith("C:\apps\dist")}
$mahoutPath = $mahoutPath -replace "\\", "/"
$jarFile = "file:///$mahoutPath"
#
# If you are using an earlier version of HDInsight,
# set $jarFile to the jar file you
# uploaded.
# For example,
# $jarFile = "wasb:///example/jars/mahout-core-0.9-job.jar"

# The arguments for this job
# * input - the path to the data uploaded to HDInsight
# * output - the path to store output data
# * tempDir - the directory for temp files
$jobArguments = "-s", "SIMILARITY_COOCCURRENCE",
                "--input", "wasb:///u.data",
                "--output", "wasb:///example/out",
                "--tempDir", "wasb:///temp/mahout"

# Create the job definition
$jobDefinition = New-AzureHDInsightMapReduceJobDefinition `
  -JarFile $jarFile `
  -ClassName "org.apache.mahout.cf.taste.hadoop.item.RecommenderJob" `
  -Arguments $jobArguments

# Start the job
$job = Start-AzureHDInsightJob -Cluster $clusterName -JobDefinition $jobDefinition

# Wait on the job to complete
Write-Host "Wait for the job to complete ..." -ForegroundColor Green
Wait-AzureHDInsightJob -Job $job

# Write out any error information
Write-Host "STDERR"
Get-AzureHDInsightJobOutput -Cluster $clusterName -JobId $job.JobId -StandardError

I have uploaded the u.data file using azure storage explorer to the root of the container which contains the hdinsight files..

I receive the error at line ..

PS C:> $job = Start-AzureHDInsightJob -Cluster $clusterName -JobDefinition $jobDefinition

The error:

Start-AzureHDInsightJob : Request failed with code:InternalServerError Content:{"error":null} At line:1 char:8 + $job = Start-AzureHDInsightJob -Cluster $clusterName -JobDefinition $jobDefiniti ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Start-AzureHDInsightJob], HttpLayerException + FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.HDInsight.Framework.Core.Library.WebRequest.HttpLayerE xception,Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.PSCmdlets.StartAzureHDInsightJobCmdlet

Any help is sincerely appeciated..

Thanks


回答1:


This looks like a recent change to either Hive/Templeton on the HDInsight cluster, where it now returns a CRLF on the end of the file path. I changed the script to the following to fix it:

$mahoutPath = Invoke-Hive -Query '!${env:COMSPEC} /c dir /b /s ${env:MAHOUT_HOME}\examples\target\*-job.jar' | where {$_.startswith("C:\apps\dist")}
$noCRLF = $mahoutPath -replace "`r`n", ""
$cleanedPath = $noCRLF -replace "\\", "/"
$jarFile = "file:///$cleanedPath"


来源:https://stackoverflow.com/questions/29454864/error-in-running-movie-recommendations-by-using-apache-mahout-with-hdinsight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!