public void PreparePack(IActionName actionName, IActionRuntime actionRuntime) { _ = actionName ?? throw new ArgumentNullException(nameof(actionName)); string lockFile = System.IO.Path.Combine(actionRuntime.WorkingDirectory, LOCK_FILENAME); string readyFile = System.IO.Path.Combine(actionRuntime.WorkingDirectory, READY_FILENAME); if (File.Exists(readyFile)) { // package is download already; return; } else if (File.Exists(lockFile)) { // other thread or process download the package this.WaitForDownLoadReady(readyFile).Wait(TimeSpan.FromMinutes(15)); } else { // begin download files this.DownLoadPackage(actionName, actionRuntime.WorkingDirectory, lockFile, readyFile); } }
protected virtual IActionContext OnCreateActionContext(IExecuteContext executeContext, IActionName actionName, IActionRuntime actionRuntime, IActionMeta actionMeta) { _ = executeContext ?? throw new ArgumentNullException(nameof(executeContext)); return(new ActionContext() { ExecutePath = executeContext.ExecutePath, Token = executeContext.Token, MetaInfo = actionMeta, RuntimeInfo = actionRuntime, ExecuteName = executeContext.ExecuteName, ServiceProvider = this.serviceProvider, Parameters = this.ConvertParameter(actionMeta, executeContext.ExecuteParameter), Logger = new ActionLogger(), Name = actionName }); }
protected virtual void OnPrepareAction(IActionName actionName, IActionRuntime actionRuntime) { this.preparePackService.PreparePack(actionName, actionRuntime); }