private void RefreshJobDefinitionList() { JobDefinition.Items.Add(new ListItem("(select job definition)", Guid.Empty.ToString())); Item.Context = RegistryContext; IEnumerable <JobDefinition> list = null; Jhu.Graywulf.Registry.Federation f = Item.QueueInstance.QueueDefinition.Parent as Jhu.Graywulf.Registry.Federation; f.LoadJobDefinitions(false); list = f.JobDefinitions.Values; foreach (JobDefinition jd in list) { JobDefinition.Items.Add(new ListItem(jd.Name, jd.Guid.ToString())); } }
public JobInstance ScheduleAsJob(Federation federation, TableOrView[] sources, string path, FileFormatDescription format, string queueName, string comments) { var job = GetInitializedJobInstance(queueName, comments); var settings = new ExportTablesJobSettings(job.JobDefinition.Settings); path = path ?? settings.OutputDirectory; path = Path.Combine(path, String.Format("{0}_{1}{2}", Context.UserName, job.JobID, Jhu.Graywulf.IO.Constants.FileExtensionZip)); var destinations = new DataFileBase[sources.Length]; for (int i = 0; i < sources.Length; i++) { var ff = FileFormatFactory.Create(federation.FileFormatFactory); var destination = ff.CreateFile(format); destination.Uri = Util.UriConverter.FromFilePath(String.Format("{0}{1}", sources[i].ObjectName, format.DefaultExtension)); // special initialization in case of a text file // TODO: move this somewhere else, maybe web? if (destination is TextDataFileBase) { var tf = (TextDataFileBase)destination; tf.Encoding = Encoding.ASCII; tf.Culture = System.Globalization.CultureInfo.InvariantCulture; tf.GenerateIdentityColumn = false; tf.ColumnNamesInFirstLine = true; } destinations[i] = destination; } var et = new ExportTables() { Sources = sources, Destinations = destinations, Archival = DataFileArchival.Zip, Uri = Util.UriConverter.FromFilePath(path), FileFormatFactoryType = federation.FileFormatFactory, StreamFactoryType = federation.StreamFactory, }; job.Parameters["Parameters"].Value = et; return job; }
/// <summary> /// Constructor for creating a new entity with object context and parent entity set. /// </summary> /// <param name="context">An object context class containing session information.</param> /// <param name="parent">The parent entity in the entity hierarchy.</param> public RemoteDatabase(Federation parent) : base(parent.Context, parent) { InitializeMembers(); }
/// <summary> /// Constructor for creating a new entity with object context and parent entity set. /// </summary> /// <param name="context">An object context class containing session information.</param> /// <param name="parent">The parent entity in the entity hierarchy.</param> public JobDefinition(Federation parent) : base(parent.Context, parent) { InitializeMembers(); }
/// <summary> /// Copy contructor for doing deep copy of the <b>Federation</b> objects. /// </summary> /// <param name="old">The <b>Federation</b> to copy from.</param> public Federation(Federation old) : base(old) { CopyMembers(old); }
/// <summary> /// Creates a deep copy of the passed object. /// </summary> /// <param name="old">A <b>Federation</b> object to create the deep copy from.</param> private void CopyMembers(Federation old) { this.shortTitle = old.shortTitle; this.longTitle = old.longTitle; this.email = old.email; this.queryFactoryTypeName = old.queryFactoryTypeName; }
public FederationInstaller(Federation federation) : base(federation.Context) { this.federation = federation; }
public ExportTablesJobInstaller(Federation federation) { this.federation = federation; }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <remarks> /// This function is primarily used by the test routine, as federations are /// not often created with default settings /// </remarks> public Federation Install(string name) { // TODO: fill in other settings from default constants. cluster.LoadMachineRoles(false); cluster.LoadDomains(false); var shareddomain = cluster.Domains[Constants.SharedDomainName]; shareddomain.LoadFederations(false); var sharedfederation = shareddomain.Federations[Constants.SharedFederationName]; sharedfederation.LoadDatabaseDefinitions(false); var tempdbdd = sharedfederation.DatabaseDefinitions[Constants.TempDbName]; tempdbdd.LoadDatabaseVersions(false); var controllerRole = cluster.MachineRoles[Constants.ControllerMachineRoleName]; controllerRole.LoadServerVersions(false); controllerRole.LoadMachines(false); var controller = controllerRole.Machines[Constants.ControllerMachineName]; controller.LoadServerInstances(false); var nodeRole = cluster.MachineRoles[Constants.NodeMachineRoleName]; nodeRole.LoadServerVersions(false); federation = new Federation(Context) { Name = name, ControllerMachine = controller, TempDatabaseVersion = tempdbdd.DatabaseVersions[Constants.TempDbName], SchemaSourceServerInstance = controller.ServerInstances[Constants.ServerInstanceName], }; GenerateDefaultSettings(); // Generate MyDB, CodeDB and jobs GenerateDefaultChildren(controllerRole.ServerVersions[Constants.ServerVersionName], nodeRole.ServerVersions[Constants.ServerVersionName]); return federation; }
/// <summary> /// Creates a deep copy of the passed object. /// </summary> /// <param name="old">A <b>Federation</b> object to create the deep copy from.</param> private void CopyMembers(Federation old) { this.queryFactory = old.queryFactory; this.fileFormatFactory = old.fileFormatFactory; this.streamFactory = old.streamFactory; this.shortTitle = old.shortTitle; this.longTitle = old.longTitle; this.email = old.email; this.copyright = old.copyright; this.disclaimer = old.disclaimer; }
public Cluster Install(bool system, string clusterName, string username, string email, string password) { cluster = new Cluster(Context) { Name = clusterName, System = system, }; cluster.Save(); // Create machine roles and machines // -- controller role var mrcont = new MachineRole(cluster) { Name = Constants.ControllerMachineRoleName, System = system, MachineRoleType = MachineRoleType.StandAlone, }; mrcont.Save(); var sv = new ServerVersion(mrcont) { Name = Constants.ServerVersionName, System = system, }; sv.Save(); var mcont = new Machine(mrcont) { Name = Constants.ControllerMachineName, }; mcont.Save(); var sicont = new ServerInstance(mcont) { Name = Constants.ServerInstanceName, ServerVersion = sv, }; sicont.Save(); // -- node role var mrnode = new MachineRole(cluster) { Name = Constants.NodeMachineRoleName, MachineRoleType = MachineRoleType.MirroredSet, }; mrnode.Save(); var nodesv = new ServerVersion(mrnode) { Name = Constants.ServerVersionName, }; nodesv.Save(); // -- Create a node /* Machine mnode = new Machine(Context, mrnode); mnode.Name = Constants.NodeMachineName; mnode.Save(); si = new ServerInstance(Context, mnode); si.Name = Constants.ServerInstanceName; si.ServerVersionReference.Value = sv; si.Save();*/ // Create the shared domain for cluster level databases and users var domain = new Domain(cluster) { Name = Constants.SharedDomainName, Email = email, System = system, }; domain.Save(); // Create administrator group and user GenerateAdminGroup(system); GenerateAdmin(system, username, email, password); // Create the shared feredation var federation = new Federation(domain) { Name = Constants.SharedFederationName, Email = email, System = system, ControllerMachine = mcont, SchemaSourceServerInstance = sicont, }; federation.Save(); // Temp database definition var tempdd = new DatabaseDefinition(federation) { Name = Constants.TempDbName, System = system, LayoutType = DatabaseLayoutType.Monolithic, DatabaseInstanceNamePattern = Constants.TempDbInstanceNamePattern, DatabaseNamePattern = Constants.TempDbNamePattern, SliceCount = 1, PartitionCount = 1, }; tempdd.Save(); var tempddi = new DatabaseDefinitionInstaller(tempdd); tempddi.GenerateDefaultChildren(nodesv, Constants.TempDbName); // Create cluster level jobs and queues // -- admin queue definition QueueDefinition qd = new QueueDefinition(cluster) { Name = Constants.MaintenanceQueueDefinitionName, System = system, }; qd.Save(); QueueInstance qi = new QueueInstance(mcont) { Name = Constants.MaintenanceQueueName, RunningState = Registry.RunningState.Running, }; qi.QueueDefinitionReference.Value = qd; qi.Save(); // -- long queue definition qd = new QueueDefinition(cluster) { Name = Constants.LongQueueDefinitionName }; qd.Save(); qi = new QueueInstance(mcont) { Name = Constants.LongQueueName, RunningState = Registry.RunningState.Running, }; qi.QueueDefinitionReference.Value = qd; qi.Save(); // -- quick queue definition qd = new QueueDefinition(cluster) { Name = Constants.QuickQueueDefinitionName, }; qd.Save(); qi = new QueueInstance(mcont) { Name = Constants.QuickQueueName, RunningState = Registry.RunningState.Running, }; qi.QueueDefinitionReference.Value = qd; qi.Save(); // -- database mirror job var jd = new JobDefinition(federation) { Name = typeof(Jhu.Graywulf.Jobs.MirrorDatabase.MirrorDatabaseJob).Name, System = system, WorkflowTypeName = typeof(Jhu.Graywulf.Jobs.MirrorDatabase.MirrorDatabaseJob).AssemblyQualifiedName, }; jd.DiscoverWorkflowParameters(); jd.Save(); // -- test job jd = new JobDefinition(federation) { Name = typeof(Jhu.Graywulf.Jobs.Test.TestJob).Name, System = system, WorkflowTypeName = typeof(Jhu.Graywulf.Jobs.Test.TestJob).AssemblyQualifiedName, }; jd.DiscoverWorkflowParameters(); jd.Save(); return cluster; }
public SqlQueryJobInstaller(Federation federation) : base(federation.Context) { this.federation = federation; }
public ExportMaintenanceJobInstaller(Federation federation) { this.federation = federation; }
/// <summary> /// Constructor for creating a new entity with object context and parent entity set. /// </summary> /// <param name="context">An object context class containing session information.</param> /// <param name="parent">The parent entity in the entity hierarchy.</param> public JobDefinition(Federation parent) : base(parent.Context, parent) { InitializeMembers(new StreamingContext()); }
public static QueryFactory Create(Federation federation) { // Load federation and get query factory name from settings var ft = Type.GetType(federation.QueryFactory); return (QueryFactory)Activator.CreateInstance(ft, federation.Context); }