Ejemplo n.º 1
0
        public Guid Export(string fileName, string graphUri)
        {
            Logging.LogDebug("Export {0}, {1}", fileName, graphUri);
            var jobId     = Guid.NewGuid();
            var exportJob = new ExportJob(jobId, this, fileName, graphUri);

            _jobExecutionStatus.TryAdd(jobId.ToString(),
                                       new JobExecutionStatus {
                JobId = jobId, JobStatus = JobStatus.Started, Queued = DateTime.UtcNow, Started = DateTime.UtcNow
            });
            exportJob.Run((id, ex) =>
            {
                JobExecutionStatus jobExecutionStatus;
                if (_jobExecutionStatus.TryGetValue(id.ToString(), out jobExecutionStatus))
                {
                    jobExecutionStatus.Information     = "Export failed";
                    jobExecutionStatus.ExceptionDetail = new ExceptionDetailObject(ex);
                    jobExecutionStatus.JobStatus       = JobStatus.TransactionError;
                    jobExecutionStatus.Ended           = DateTime.UtcNow;
                }
            },
                          id =>
            {
                JobExecutionStatus jobExecutionStatus;
                if (_jobExecutionStatus.TryGetValue(id.ToString(), out jobExecutionStatus))
                {
                    jobExecutionStatus.Information = "Export completed";
                    jobExecutionStatus.JobStatus   = JobStatus.CompletedOk;
                    jobExecutionStatus.Ended       = DateTime.UtcNow;
                }
            });
            return(jobId);
        }
Ejemplo n.º 2
0
        public Guid Export(string fileName, string graphUri, RdfFormat exportFormat, string jobLabel = null)
        {
            Logging.LogDebug("Export {0}, {1}, {2}", fileName, graphUri, exportFormat.DefaultExtension);
            var jobId     = Guid.NewGuid();
            var exportJob = new ExportJob(jobId, jobLabel, this, fileName, graphUri, exportFormat);

            _jobExecutionStatus.TryAdd(jobId.ToString(),
                                       new JobExecutionStatus
            {
                JobId     = jobId,
                JobStatus = JobStatus.Started,
                Queued    = DateTime.UtcNow,
                Started   = DateTime.UtcNow,
                Label     = jobLabel,
                WaitEvent = new AutoResetEvent(false)
            });
            exportJob.Run((id, ex) =>
            {
                JobExecutionStatus jobExecutionStatus;
                if (_jobExecutionStatus.TryGetValue(id.ToString(), out jobExecutionStatus))
                {
                    jobExecutionStatus.Information     = "Export failed";
                    jobExecutionStatus.ExceptionDetail = GetExceptionDetail(ex);
                    jobExecutionStatus.JobStatus       = JobStatus.TransactionError;
                    jobExecutionStatus.Ended           = DateTime.UtcNow;
                    jobExecutionStatus.WaitEvent.Set();
                }
            },
                          id =>
            {
                JobExecutionStatus jobExecutionStatus;
                if (_jobExecutionStatus.TryGetValue(id.ToString(), out jobExecutionStatus))
                {
                    jobExecutionStatus.Information = "Export completed";
                    jobExecutionStatus.JobStatus   = JobStatus.CompletedOk;
                    jobExecutionStatus.Ended       = DateTime.UtcNow;
                    jobExecutionStatus.WaitEvent.Set();
                }
            });
            return(jobId);
        }
Ejemplo n.º 3
0
 public Guid Export(string fileName, string graphUri)
 {
     var jobId = Guid.NewGuid();
     var exportJob = new ExportJob(jobId, this, fileName, graphUri);
     _jobExecutionStatus.TryAdd(jobId.ToString(),
                                new JobExecutionStatus {JobId = jobId, JobStatus = JobStatus.Started});
     exportJob.Run((id, ex) =>
                       {
                           JobExecutionStatus jobExecutionStatus;
                           if (_jobExecutionStatus.TryGetValue(id.ToString(), out jobExecutionStatus))
                           {
                               jobExecutionStatus.Information = "Export failed";
                               jobExecutionStatus.ExceptionDetail = new ExceptionDetail(ex);
                               jobExecutionStatus.JobStatus = JobStatus.TransactionError;
                               jobExecutionStatus.Ended = DateTime.UtcNow;
                           }
                       },
                   id =>
                       {
                           JobExecutionStatus jobExecutionStatus;
                           if (_jobExecutionStatus.TryGetValue(id.ToString(), out jobExecutionStatus))
                           {
                               jobExecutionStatus.Information = "Export completed";
                               jobExecutionStatus.JobStatus = JobStatus.CompletedOk;
                               jobExecutionStatus.Ended = DateTime.UtcNow;
                           }
                       });
     return jobId;
 }
Ejemplo n.º 4
0
 public Guid Export(string fileName, string graphUri, RdfFormat exportFormat, string jobLabel = null)
 {
     Logging.LogDebug("Export {0}, {1}, {2}", fileName, graphUri, exportFormat.DefaultExtension);
     var jobId = Guid.NewGuid();
     var exportJob = new ExportJob(jobId, jobLabel, this, fileName, graphUri, RdfFormat.NQuads);
     _jobExecutionStatus.TryAdd(jobId.ToString(),
                                new JobExecutionStatus
                                    {
                                        JobId = jobId,
                                        JobStatus = JobStatus.Started,
                                        Queued = DateTime.UtcNow,
                                        Started = DateTime.UtcNow,
                                        Label = jobLabel
                                    });
     exportJob.Run((id, ex) =>
                       {
                           JobExecutionStatus jobExecutionStatus;
                           if (_jobExecutionStatus.TryGetValue(id.ToString(), out jobExecutionStatus))
                           {
                               jobExecutionStatus.Information = "Export failed";
                               jobExecutionStatus.ExceptionDetail = new ExceptionDetailObject(ex);
                               jobExecutionStatus.JobStatus = JobStatus.TransactionError;
                               jobExecutionStatus.Ended = DateTime.UtcNow;
                           }
                       },
                   id =>
                       {
                           JobExecutionStatus jobExecutionStatus;
                           if (_jobExecutionStatus.TryGetValue(id.ToString(), out jobExecutionStatus))
                           {
                               jobExecutionStatus.Information = "Export completed";
                               jobExecutionStatus.JobStatus = JobStatus.CompletedOk;
                               jobExecutionStatus.Ended = DateTime.UtcNow;
                           }
                       });
     return jobId;
 }