我正在使用一个蜂窝流式作业来处理HDInsight上的C#中的一些数据。为了处理数据,脚本必须读取存储为Azure上的blob的xml文件,如下所示:
OperationContext oc = new OperationContext();
CloudStorageAccount account = new CloudStorageAccount(new StorageCredentials(asvAccount, asvKey), true);
CloudBlobClient client = account.CreateCloudBlobClient();
CloudBlobContainer container = client.GetContainerReference("myContainer");
CloudBlockBlob blob = container.GetBlockBlobReference("file/f.xml");
MemoryStream stream;
using (stream = new MemoryStream())
{
blob.DownloadToStream(stream);
stream.Seek(0, SeekOrigin.Begin);
string reader = new StreamReader(stream).ReadToEnd();
elem = XElement.Parse(reader);
return elem;
}
代码在我的本地机器上工作:它从存储帐户读取文件并正确返回elem,但是当我尝试在集群上运行它时,即使我通过fs.put()将其添加到/ hive / Microsoft.WindowsAzure.Storage.dll /,然后在配置单元门户中执行"add file“,它仍然在查找文件时出现问题。
如果我尝试像这样访问该文件:
XElement.Load("hdinsighttesting.blob.core.windows.net/repexdeema/pr/productGuidMapping.xml");
或
XElement.Load("asv://myContainer@myCluster.blob.core.windows.net/file/f.xml"); then I get the following error:
Could not find a part of the path 'c:\hdfs\mapred\local\taskTracker\admin\jobcache\job_201307200714_0079\attempt_201307200714_0079_m_000000_0\work\storageAccount.blob.core.windows.net\myContainer\pr\productGuidMapping.xml
我不明白为什么它坚持在那个目录中查找,而不是直接转到blob存储。我尝试转到那个目录,但它不存在。
我也考虑过使用LocalResource,但在我的情况下这是不可能的,因为Hive拒绝查找我上传到hdfs中的dll文件。
谢谢
发布于 2013-07-24 16:26:43
"add file“应该足够了。它会将dll复制到工作文件夹中,并对您的脚本可用。Microsoft.WindowsAzure.Storage.dll有它自己的依赖项。我相信OData.dll和edm.dll。确保添加文件的所有依赖项,否则它将无法加载。
https://stackoverflow.com/questions/17824107
复制相似问题