Permalink
Browse files

Updated EventSource names and started CreateWarehouseReportsJob

  • Loading branch information...
1 parent 26c6229 commit 2486f7a760b7bd5e70d011eaf9620e8fc3be21d3 @anurse anurse committed Jan 28, 2014
Showing with 238 additions and 76 deletions.
  1. +3 −1 src/Services/NuCmd/Commands/Scheduler/JobsCommand.cs
  2. +8 −6 src/Services/NuCmd/Commands/Scheduler/NewJobCommand.cs
  3. +94 −0 src/Services/NuCmd/Commands/Scheduler/RefreshJobCommand.cs
  4. +1 −0 src/Services/NuCmd/NuCmd.csproj
  5. +17 −8 src/Services/NuCmd/Strings.resx
  6. +35 −8 src/Services/NuCmd/Strings1.Designer.cs
  7. +1 −1 src/Services/NuGet.Services.Platform/ServicePlatformEventSource.cs
  8. +1 −0 src/Services/Work/NuGet.Services.Work/Jobs/AggregateStatisticsJob.cs
  9. +1 −0 src/Services/Work/NuGet.Services.Work/Jobs/BackupPackageBlobsJob.cs
  10. +1 −0 src/Services/Work/NuGet.Services.Work/Jobs/CleanOnlineDatabaseBackupsJob.cs
  11. +1 −1 src/Services/Work/NuGet.Services.Work/Jobs/CreateOnlineDatabaseBackupJob.cs
  12. +29 −0 src/Services/Work/NuGet.Services.Work/Jobs/CreateWarehouseReportsJob.cs
  13. +5 −4 src/Services/Work/NuGet.Services.Work/Jobs/HandlePackageEditsJob.cs
  14. +3 −1 src/Services/Work/NuGet.Services.Work/Jobs/PurgeCompletedInvocationsJob.cs
  15. +1 −0 src/Services/Work/NuGet.Services.Work/Jobs/PurgePackageStatisticsJob.cs
  16. +1 −0 src/Services/Work/NuGet.Services.Work/Jobs/ReplicatePackageStatisticsJob.cs
  17. +1 −1 src/Services/Work/NuGet.Services.Work/Jobs/TestAsyncJob.cs
  18. +1 −1 src/Services/Work/NuGet.Services.Work/Jobs/TestHeartBeatJob.cs
  19. +5 −5 src/Services/Work/NuGet.Services.Work/Jobs/{TestLongJob.cs → TestLongRunningJob.cs}
  20. +1 −1 src/Services/Work/NuGet.Services.Work/Jobs/TestPingJob.cs
  21. +15 −35 src/Services/Work/NuGet.Services.Work/Jobs/UpdateLicenseReportsJob.cs
  22. +1 −1 src/Services/Work/NuGet.Services.Work/Monitoring/InvocationEventSource.cs
  23. +1 −1 src/Services/Work/NuGet.Services.Work/Monitoring/WorkServiceEventSource.cs
  24. +11 −1 src/Services/Work/NuGet.Services.Work/NuGet.Services.Work.csproj
@@ -19,7 +19,6 @@ public class JobsCommand : SchedulerCommandBase
[ArgDescription("Specifies the scheduler service for the collection. Defaults to the standard one for this environment (nuget-[environment]-0-scheduler)")]
public string CloudService { get; set; }
- [ArgRequired]
[ArgShortcut("c")]
[ArgDescription("The job collection to list jobs from")]
public string Collection { get; set; }
@@ -34,6 +33,9 @@ public class JobsCommand : SchedulerCommandBase
CloudService = String.IsNullOrEmpty(CloudService) ?
String.Format("nuget-{0}-0-scheduler", TargetEnvironment.Name) :
CloudService;
+ Collection = String.IsNullOrEmpty(Collection) ?
+ String.Format("nuget-{0}-0-scheduler-0", TargetEnvironment.Name) :
+ Collection;
using (var client = CloudContext.Clients.CreateSchedulerClient(Credentials, CloudService, Collection))
{
@@ -10,6 +10,7 @@
using Microsoft.WindowsAzure.Scheduler.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
+using NuGet.Services.Client;
using NuGet.Services.Work;
using NuGet.Services.Work.Models;
using PowerArgs;
@@ -23,20 +24,18 @@ public class NewJobCommand : SchedulerCommandBase
[ArgDescription("Specifies the scheduler service for the collection. Defaults to the standard one for this environment (nuget-[environment]-0-scheduler)")]
public string CloudService { get; set; }
- [ArgRequired]
- [ArgPosition(0)]
[ArgShortcut("c")]
[ArgDescription("The collection in which to put the job")]
public string Collection { get; set; }
[ArgRequired]
- [ArgPosition(1)]
+ [ArgPosition(0)]
[ArgShortcut("j")]
[ArgDescription("The job to invoke")]
public string Job { get; set; }
[ArgRequired]
- [ArgPosition(2)]
+ [ArgPosition(1)]
[ArgShortcut("i")]
[ArgDescription("The name of the job instance to create")]
public string InstanceName { get; set; }
@@ -89,6 +88,9 @@ public class NewJobCommand : SchedulerCommandBase
CloudService = String.IsNullOrEmpty(CloudService) ?
String.Format("nuget-{0}-0-scheduler", TargetEnvironment.Name) :
CloudService;
+ Collection = String.IsNullOrEmpty(Collection) ?
+ String.Format("nuget-{0}-0-scheduler-0", TargetEnvironment.Name) :
+ Collection;
if (!String.IsNullOrEmpty(EncodedPayload))
{
@@ -120,7 +122,7 @@ public class NewJobCommand : SchedulerCommandBase
JobInstanceName = InstanceName,
UnlessAlreadyRunning = Singleton
};
- var body = JsonConvert.SerializeObject(bodyValue);
+ var body = await JsonFormat.SerializeAsync(bodyValue);
var request = new JobCreateOrUpdateParameters()
{
@@ -130,7 +132,7 @@ public class NewJobCommand : SchedulerCommandBase
Type = JobActionType.Https,
Request = new JobHttpRequest()
{
- Uri = new Uri(ServiceUri, "invocations"),
+ Uri = new Uri(ServiceUri, "work/invocations"),
Method = "PUT",
Body = body,
Headers = new Dictionary<string, string>()
@@ -0,0 +1,94 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.WindowsAzure;
+using Microsoft.WindowsAzure.Scheduler.Models;
+using NuGet.Services.Client;
+using NuGet.Services.Work.Models;
+using PowerArgs;
+
+namespace NuCmd.Commands.Scheduler
+{
+ [Description("Refreshes the URL used by the job to ping the job service")]
+ public class RefreshJobCommand : SchedulerCommandBase
+ {
+ [ArgShortcut("cs")]
+ [ArgDescription("Specifies the scheduler service for the collection. Defaults to the standard one for this environment (nuget-[environment]-0-scheduler)")]
+ public string CloudService { get; set; }
+
+ [ArgPosition(1)]
+ [ArgShortcut("c")]
+ [ArgDescription("The collection in which to put the job")]
+ public string Collection { get; set; }
+
+ [ArgRequired]
+ [ArgPosition(0)]
+ [ArgShortcut("i")]
+ [ArgDescription("The name of the job instance to create")]
+ public string InstanceName { get; set; }
+
+ [ArgShortcut("url")]
+ [ArgDescription("The URI to the root of the work service")]
+ public Uri ServiceUri { get; set; }
+
+ protected override async Task OnExecute()
+ {
+ CloudService = String.IsNullOrEmpty(CloudService) ?
+ String.Format("nuget-{0}-0-scheduler", TargetEnvironment.Name) :
+ CloudService;
+ Collection = String.IsNullOrEmpty(Collection) ?
+ String.Format("nuget-{0}-0-scheduler-0", TargetEnvironment.Name) :
+ Collection;
+
+ // Locate the work service
+ if (ServiceUri == null)
+ {
+ ServiceUri = TargetEnvironment.GetServiceUri("work");
+ }
+
+ if (ServiceUri == null)
+ {
+ await Console.WriteErrorLine(Strings.ParameterRequired, "SerivceUri");
+ }
+ else
+ {
+ using (var client = CloudContext.Clients.CreateSchedulerClient(Credentials, CloudService, Collection))
+ {
+ var job = await client.Jobs.GetAsync(InstanceName, CancellationToken.None);
+ if (job == null)
+ {
+ await Console.WriteErrorLine(Strings.Scheduler_RefreshJobCommand_NoSuchJob, InstanceName);
+ }
+ else if (job.Job.Action.Type == JobActionType.StorageQueue || job.Job.Action.Request == null)
+ {
+ await Console.WriteErrorLine(Strings.Scheduler_RefreshJobCommand_NotAWorkServiceJob, InstanceName);
+ }
+ else
+ {
+ Uri old = job.Job.Action.Request.Uri;
+ job.Job.Action.Request.Uri = new Uri(ServiceUri, "work/invocations");
+ await Console.WriteInfoLine(
+ Strings.Scheduler_RefreshJobCommand_UpdatingUrl,
+ InstanceName,
+ old.AbsoluteUri,
+ job.Job.Action.Request.Uri.AbsoluteUri);
+ if (!WhatIf)
+ {
+ await client.Jobs.CreateOrUpdateAsync(InstanceName, new JobCreateOrUpdateParameters()
+ {
+ StartTime = job.Job.StartTime,
+ Action = job.Job.Action,
+ Recurrence = job.Job.Recurrence
+ }, CancellationToken.None);
+ }
+ }
+ }
+ }
+ }
+ }
+}
@@ -133,6 +133,7 @@
<Compile Include="Commands\Scheduler\CollectionsCommand.cs" />
<Compile Include="Commands\Scheduler\NewServiceCommand.cs" />
<Compile Include="Commands\Scheduler\NewJobCommand.cs" />
+ <Compile Include="Commands\Scheduler\RefreshJobCommand.cs" />
<Compile Include="Commands\Scheduler\SchedulerCommandBase.cs" />
<Compile Include="Commands\Scheduler\DeleteServiceCommand.cs" />
<Compile Include="Commands\Scheduler\ServicesCommand.cs" />
@@ -213,16 +213,16 @@ Details:
nucmd &lt;group&gt; &lt;command&gt;</value>
</data>
<data name="Work_InvokeCommand_CreatedInvocation" xml:space="preserve">
- <value>Created Invocation: {0}</value>
+ <value>Created Invocation: {0}.</value>
</data>
<data name="Work_InvokeCommand_CreatingInvocation_NoPayload" xml:space="preserve">
- <value>Creating Invocation of {0} with no payload</value>
+ <value>Creating Invocation of {0} with no payload.</value>
</data>
<data name="Work_InvokeCommand_CreatingInvocation_WithPayload" xml:space="preserve">
<value>Creating Invocation of {0} with the following payload:</value>
</data>
<data name="Work_InvokeCommand_PayloadInvalid" xml:space="preserve">
- <value>Error deserializing payload: {0}</value>
+ <value>Error deserializing payload: {0}.</value>
</data>
<data name="Work_PurgeCommand_PurgingAllInvocations" xml:space="preserve">
<value>Purging all invocations...</value>
@@ -231,27 +231,36 @@ Details:
<value>Purging invocations completed before {0} UTC...</value>
</data>
<data name="Work_StatsCommand_UnknownStatsType" xml:space="preserve">
- <value>Unknown stats type: {0}</value>
+ <value>Unknown stats type: {0}.</value>
</data>
<data name="Work_LogCommand_FetchingLog" xml:space="preserve">
<value>Fetching log data for Invocation {0}...</value>
</data>
<data name="Work_LogCommand_RenderedLog" xml:space="preserve">
- <value>End of log for Invocation {0}</value>
+ <value>End of log for Invocation {0}.</value>
</data>
<data name="Work_LogCommand_RenderingLog" xml:space="preserve">
- <value>Log entries for Invocation {0}</value>
+ <value>Log entries for Invocation {0}.</value>
</data>
<data name="Work_RunCommand_Invoked" xml:space="preserve">
- <value>Completed invocation of job {0}</value>
+ <value>Completed invocation of job {0}.</value>
</data>
<data name="Work_RunCommand_Invoking" xml:space="preserve">
- <value>Invoking job: {0}</value>
+ <value>Invoking job: {0}.</value>
</data>
<data name="Work_RunCommand_UnknownJob" xml:space="preserve">
<value>Unknown job: {0}.</value>
</data>
<data name="Work_InvokeCommand_AlreadyRunning" xml:space="preserve">
<value>An invocation of this job is already in progress.</value>
</data>
+ <data name="Scheduler_RefreshJobCommand_NoSuchJob" xml:space="preserve">
+ <value>No such job: {0}.</value>
+ </data>
+ <data name="Scheduler_RefreshJobCommand_NotAWorkServiceJob" xml:space="preserve">
+ <value>The job '{0}' is not a work service invocation.</value>
+ </data>
+ <data name="Scheduler_RefreshJobCommand_UpdatingUrl" xml:space="preserve">
+ <value>Updating target url for job '{0}' from '{1}' to '{2}'</value>
+ </data>
</root>

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -9,7 +9,7 @@
namespace NuGet.Services
{
- [EventSource(Name = "NuGet-Services")]
+ [EventSource("Outercurve-NuGet-Services")]
public class ServicePlatformEventSource : EventSource
{
public static readonly ServicePlatformEventSource Log = new ServicePlatformEventSource();
@@ -120,6 +120,7 @@ COMMIT TRANSACTION
";
}
+ [EventSource("Outercurve-NuGet-Jobs-AggregateStatistics")]
public class AggregateStatisticsEventSource : EventSource
{
public static readonly AggregateStatisticsEventSource Log = new AggregateStatisticsEventSource();
@@ -210,6 +210,7 @@ public BackupPackageBlobsJob(ConfigurationHub config, StorageHub storage)
}
}
+ [EventSource("Outercurve-NuGet-Jobs-BackupPackageBlobs")]
public class BackupPackageBlobsEventSource : EventSource
{
public static readonly BackupPackageBlobsEventSource Log = new BackupPackageBlobsEventSource();
@@ -98,6 +98,7 @@ public class CleanOnlineDatabaseBackupsJob : DatabaseJobHandlerBase<CleanOnlineD
}
}
+ [EventSource("Outercurve-NuGet-Jobs-CleanOnlineDatabaseBackups")]
public class CleanOnlineDatabaseBackupsEventSource : EventSource
{
public static readonly CleanOnlineDatabaseBackupsEventSource Log = new CleanOnlineDatabaseBackupsEventSource();
@@ -162,7 +162,7 @@ private JobContinuation ContinueCheckingBackup()
}
}
- [EventSource(Name = "NuGet-Jobs-CreateOnlineDatabaseBackup")]
+ [EventSource("Outercurve-NuGet-Jobs-CreateOnlineDatabaseBackup")]
public class CreateOnlineDatabaseBackupEventSource : EventSource
{
public static readonly CreateOnlineDatabaseBackupEventSource Log = new CreateOnlineDatabaseBackupEventSource();
Oops, something went wrong.

0 comments on commit 2486f7a

Please sign in to comment.