コード例 #1
0
        private static Func<Blob, BlobDeployment> Deploy(JobExecutionFactoryContext context)
        {
            return blob =>
            {
                string root = context.Entry.Path;
                string path = Path.Combine(root, "blob");

                return blob.DeployTo(path);
            };
        }
コード例 #2
0
        private static Func<int> GetPid(JobExecutionFactoryContext context)
        {
            return () =>
            {
                string root = context.Entry.Path;
                string path = Path.Combine(root, "metadata");
                string file = Path.Combine(path, ".pid");

                return Int32.Parse(File.ReadAllText(file));
            };
        }
コード例 #3
0
        private static Func<JobExecutionStatus> GetStatus(JobExecutionFactoryContext context)
        {
            return () =>
            {
                string root = context.Entry.Path;
                string path = Path.Combine(root, "metadata");

                if (File.Exists(Path.Combine(path, ".completed")))
                    return JobExecutionStatus.Completed;

                if (File.Exists(Path.Combine(path, ".pid")))
                    return JobExecutionStatus.Running;

                if (File.Exists(Path.Combine(path, ".scheduled")))
                    return JobExecutionStatus.Pending;

                if (File.Exists(Path.Combine(path, ".failed")))
                    return JobExecutionStatus.Failed;

                return JobExecutionStatus.Idle;
            };
        }
コード例 #4
0
        private static Func<JobSchedule, DateTime?> NextRun(JobExecutionFactoryContext context)
        {
            return schedule =>
            {
                if (schedule == null)
                    return null;

                DateTime? lastExecutedAt = null;
                string root = context.Entry.Path;

                string path = Path.Combine(root, "metadata");
                string file = Path.Combine(path, ".completed");

                if (File.Exists(file))
                    lastExecutedAt = File.GetCreationTime(file);

                return schedule.Next(lastExecutedAt);
            };
        }
コード例 #5
0
        private static Action<int> OnStarted(JobExecutionFactoryContext context)
        {
            return pid =>
            {
                string root = context.Entry.Path;
                string path = Path.Combine(root, "metadata");
                string file = Path.Combine(path, ".pid");

                File.WriteAllText(file, pid.ToString());
            };
        }
コード例 #6
0
        private static Action OnScheduled(JobExecutionFactoryContext context)
        {
            return () =>
            {
                string root = context.Entry.Path;
                string path = Path.Combine(root, "metadata");
                string file = Path.Combine(path, ".scheduled");

                File.WriteAllBytes(file, new byte[0]);
            };
        }
コード例 #7
0
 private static Action<JobProcessorUsage> OnProcessor(JobExecutionFactoryContext context)
 {
     return usage =>
     {
     };
 }
コード例 #8
0
 private static Action<JobMemoryUsage> OnMemory(JobExecutionFactoryContext context)
 {
     return usage =>
     {
     };
 }
コード例 #9
0
        private static Action<string> OnFailed(JobExecutionFactoryContext context)
        {
            return reason =>
            {
                string root = context.Entry.Path;
                string path = Path.Combine(root, "metadata");
                string file = Path.Combine(path, ".failed");

                File.WriteAllText(file, reason);
            };
        }