Quickly disable all data cubes warehouse schedules

I have several data cubes that are warehoused on a schedule. I’ve run into an emergency with our database servers and I need to disable all of the cubes. The only way I can do this is to disable each individual cube. Is there a way to disable all cubes either in a project or globally?

Thanks,
Matt

There is currently no way to disable all of your schedules in a single go. I have filed a feature request for you as this is a good idea. #78075 for you reference

If this is a common occurrence for you, something like this could be developed using our API.

I have a dashboard that does this - as this is a common thing that we need to do when duplicating projects. There is a dropdown to select the project, and then checkboxes for the cubes to be affected.

The following hacked together script will disable the schedules of all cubes in the project named in the first line. If there is no schedule set, you will see a 404 in the console, but the script will still continue to the next cubes.

No responsibility taken for this script etc etc.

I’m sure that someone can do this a lot better, but something similar to this works for me.

To re-renable, just change ‘false’ to ‘true’

projectName = "PROJECT NAME";

ps = dundas.context.getService("ProjectService");

//loop through all the projects
ps.getAllProjects().done(function (projects)
{
	//console.log(projects);
	projects.forEach(function (eachProject)
	{
		//console.log(eachProject.name);

		if (eachProject.name === projectName) //this is the one that we want
		{
			console.log("project is", eachProject.name, eachProject.id);
			getChildren(eachProject.id); //get all the cubes
		}

		getChildren = function (projectId)
		{
			//get all the items in the project
			dundas.context.getService("FileSystemService").getEntryById(projectId, dundas.filesystem.GetEntryOptions.INCLUDE_CHILDREN).done(function (f)
			{
				f.allChildren.forEach(function (eachFile)
				{
					if (eachFile.objectType.includes("Folder"))
					{
						//if a folder, recursively get the cubes from it
						getChildren(eachFile.id);
					}
					else
					{
						if (eachFile.objectType.includes("DataCube")) //if it's a cube
						{
							console.log(eachFile.id, eachFile.friendlyName);
							//disable the schedule
							disableSchedule(eachFile.id); 
						}
					}
				}
				);
			}
			)
		}
		disableSchedule = function (cube)
		{
			//get the schedule
			dundas.context.getService("DataCubeService").getSchedule(cube).done(function (originalSchedule)
			{
				//switch it off
				originalSchedule.isEnabled = false;
				//put the modified schedule back into the cube
				dundas.context.getService("DataCubeService").scheduleWarehouse(cube, originalSchedule);
			}
			)
		}

	}
	)
}
)
1 Like

David,

Thank you for this. I’ll give it a try the next time we have a disaster.

Matt

@david.glickman That is Awesome sauce! (thanks for the proff read Jef)

This should be in the cheats section.

Assume sauce? Isn’t the term ‘Awesome Sauce’? I can’t keep up with all these new buzzwords anymore…

+1 on the cheats section, nice script.

I think the correct term is ‘Anonymous Sauce’. :clown_face: