gordonwatts / LINQtoROOT

Convert a LINQ query into a ROOT TSelector, and run it
GNU Lesser General Public License v2.1
1 stars 0 forks source link

Crash looking for a template file #268

Open gordonwatts opened 6 years ago

gordonwatts commented 6 years ago

This is likely b.c. of the way we are doing our current directory (??).

LINTToTTreeLib Start: 13 : ExecuteQueuedQueriesForAScheme: Will part out 1 Uri's to run on remotebash.
LINTToTTreeLib Start: 13 : ExecuteQueuedQueriesForAScheme: Start run on Uri scheme remotebash, 1 files.
LINTToTTreeLib Stop: 13 : ExecuteQueuedQueriesForAScheme: Finished run on Uri scheme remotebash.
LINTToTTreeLib Stop: 13 : ExecuteQueuedQueriesForAScheme: Finished run on Uri scheme remotebash.
LINTToTTreeLib Stop: 13 : ExecuteQueuedQueriesForAScheme: Finished run on Uri scheme remotebash.
LINTToTTreeLib Stop: 13 : ExecuteQueuedQueriesForAScheme: Finished run on Uri scheme remotebash.
LINTToTTreeLib Stop: 13 : ExecuteQueuedQueriesForAScheme: Finished run on Uri scheme remotebash.

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Unable to locatoin LINQToTTree template file 'TSelectorTemplate.cxx' in any standard location (tried 'C:\Users\gordo\Documents\Code\calratio2017\JetCutStudies\GenericPerformancePlots\bin\x86\Debug\Templates\TSelectorTemplate.cxx' and 'C:\Users\gordo\Documents\Code\calratio2017\JetCutStudies\GenericPerformancePlots\bin\x86\Debug\TSelectorTemplate.cxx' and 'C:\Users\gordo\AppData\Local\LINQToTTree\Templates\TSelectorTemplate.cxx'.
   at LINQToTTreeLib.TTreeQueryExecutor.TemplateDirectory(String templateName)
   at LINQToTTreeLib.TTreeQueryExecutor.WriteTSelector(String proxyFileName, String proxyObjectName, IExecutableCode code, DirectoryInfo queryDirectory)
   at LINQToTTreeLib.TTreeQueryExecutor.<ExecuteQueuedQueriesForAScheme>d__62.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at LINQToTTreeLib.TTreeQueryExecutor.<ExecuteQueuedQueries>d__59.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at LINQToTreeHelpers.FutureUtils.FutureTDirectory.Write(Boolean calculateEverything)
   at GenericPerformancePlots.Program.<Main>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at GenericPerformancePlots.Program.<Main>(String[] args)
gordonwatts commented 6 years ago

And another crash where we weren't able to find the files describing the local tev cluster.

Searching for all occurrences of CurrentDirectory...

gordonwatts commented 6 years ago

What is interesting about the above crash is that the template file actually exists at that first location!

gordonwatts commented 6 years ago

And the code couldn't be cleaner - or more immune to multi-threaded issues.

        private string TemplateDirectory(string templateName)
        {
            var assDir = new FileInfo(Assembly.GetCallingAssembly().Location);
            var assGuess = string.Format(@"{0}\Templates\{1}", assDir.DirectoryName, templateName);
            if (File.Exists(assGuess))
                return assGuess;

            var assGuess1 = string.Format(@"{0}\{1}", assDir.DirectoryName, templateName);
            if (File.Exists(assGuess1))
                return assGuess1;

            var guess = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\LINQToTTree\\Templates\\" + templateName;
            if (File.Exists(guess))
                return guess;

            throw new FileNotFoundException($"Unable to locatoin LINQToTTree template file '{templateName}' in any standard location (tried '{assGuess}' and '{assGuess1}' and '{guess}'.");
        }
gordonwatts commented 6 years ago

Need to see this happen a little more often.