Documentation ¶
Overview ¶
Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.
Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.
Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information. Package edasim implements the structures, methods, and functions used by the EDA simulator
Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.
Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.
Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.
Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.
Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.
Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.
Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.
Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.
Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.
Index ¶
- Constants
- Variables
- func GenerateBatchName(jobCount int) string
- func GenerateBatchName2(jobCount int) string
- func GenerateBatchNameFromJobRun(uniqueName string, jobRunName string, batchid int) string
- func GetBatchName(fullFilePath string) string
- func GetBatchNamePartsFromJobRun(fullFilePath string) (string, string)
- func GetEventHubName(uniqueName string) string
- func GetJobCompleteQueueName(uniqueName string) string
- func GetJobRunQueueName(uniqueName string) string
- func GetJobStartQueueName(uniqueName string) string
- func GetWorkCompleteQueueName(uniqueName string) string
- func GetWorkStartQueueName(uniqueName string) string
- func InitializeReaderWriters(ctx context.Context, eventHubSenderName string, eventHubSenderKey string, ...) *azure.EventHubSender
- func SetStatsChannel(ctx context.Context) context.Context
- func StatsCollector(ctx context.Context, syncWaitGroup *sync.WaitGroup)
- type EdasimFile
- type JobConfigFile
- type JobRun
- type JobSubmitter
- type Orchestrator
- type StatsChannels
- type WorkFileWriter
Constants ¶
const ( JobDir = "/job" WorkDir = "/work" StatsDir = "/stats" QueueJobReady = "jobready" QueueJobComplete = "jobcomplete" QueueJobProcess = "jobprocess" QueueUploader = "uploader" DefaultFileSizeKB = 384 DefaultJobCount = 10 DefaultJobSubmitterThreadCount = 1 DefaultOrchestratorThreads = 16 DefaultWorkStartFiles = 3 DefaultJobEndFiles = 12 KB = 1024 MB = KB * KB JobReaderLabel = "JobReader" JobWriterLabel = "JobWriter" JobCompleteReaderLabel = "JobCompleteReader" JobCompleteWriterLabel = "JobCompleteWriter" WorkStartFileReaderLabel = "WorkStartFileReader" WorkStartFileWriterLabel = "WorkStartFileWriter" WorkCompleteFileReaderLabel = "WorkCompleteFileReader" WorkCompleteFileWriterLabel = "WorkCompleteFileWriter" )
const (
QueueMessageCount = 1
)
Variables ¶
var ( // JobWriter is the writer used for job files JobWriter *file.ReaderWriter // JobReader is the reader used for readung job files JobReader *file.ReaderWriter // WorkStartFileWriter is the writer used for work start files WorkStartFileWriter *file.ReaderWriter // WorkStartFileReader is the reader used for work start files WorkStartFileReader *file.ReaderWriter // WorkCompleteFileWriter is the writer used for work complete files WorkCompleteFileWriter *file.ReaderWriter // WorkCompleteFileReader is the reader used for work complete files WorkCompleteFileReader *file.ReaderWriter // JobCompleteWriter is the writer used for job complete files JobCompleteWriter *file.ReaderWriter // JobCompleteReader is the reader used for job complete files JobCompleteReader *file.ReaderWriter )
Functions ¶
func GenerateBatchName ¶
GenerateBatchName generates a batchname based on time
func GenerateBatchName2 ¶
GenerateBatchName2 generates a batchname based on time
func GenerateBatchNameFromJobRun ¶
GenerateBatchNameFromJobRun generates a batch name from unique name and job run name and batch id
func GetBatchName ¶
GetBatchName returns the batch name, which is just the parent directory
func GetBatchNamePartsFromJobRun ¶
GetBatchNamePartsFromJobRun generates the parts of the batch name
func GetEventHubName ¶
GetEventHubName returns the event hub name
func GetJobCompleteQueueName ¶
GetJobCompleteQueueName returns the job complete queue name
func GetJobRunQueueName ¶
GetJobRunQueueName returns the job run queue name
func GetJobStartQueueName ¶
GetJobStartQueueName returns the job run queue name
func GetWorkCompleteQueueName ¶
GetWorkCompleteQueueName returns the work complete queue name
func GetWorkStartQueueName ¶
GetWorkStartQueueName returns the work start queue name
func InitializeReaderWriters ¶
func InitializeReaderWriters( ctx context.Context, eventHubSenderName string, eventHubSenderKey string, eventHubNamespaceName string, eventHubHubName string) *azure.EventHubSender
InitializeReaderWriters initializes the reader writers with event hub profiling
func SetStatsChannel ¶
SetStatsChannel adds the stats channel to the context
Types ¶
type EdasimFile ¶
EdasimFile breaks an edasimfile into three parts
func InitializeEdasimFileFromString ¶
func InitializeEdasimFileFromString(edasimFileString string) (*EdasimFile, error)
InitializeEdasimFileFromString reads a edasimFileString from json string
func (*EdasimFile) GetEdasimFileString ¶
func (e *EdasimFile) GetEdasimFileString() (string, error)
GetEdasimFileString returns the JSON representation of the edasimFileString
type JobConfigFile ¶
JobConfigFile represents a job configuration file
func InitializeJobCompleteFile ¶
func InitializeJobCompleteFile(name string, jobRun *JobRun) *JobConfigFile
InitializeJobCompleteFile sets the unique name of the job configuration and the batch name and is used to signify job completion
func InitializeJobConfigFile ¶
func InitializeJobConfigFile(name string, jobRun *JobRun) *JobConfigFile
InitializeJobConfigFile sets the unique name of the job configuration and the batch name
func ReadJobConfigFile ¶
func ReadJobConfigFile(reader *file.ReaderWriter, filename string) (*JobConfigFile, error)
ReadJobConfigFile reads a job config file from disk
func (*JobConfigFile) WriteJobConfigFile ¶
func (j *JobConfigFile) WriteJobConfigFile(writer *file.ReaderWriter, filepath string, fileSize int) (string, error)
WriteJobConfigFile writes the job configuration file to disk, padding it so it makes the necessary size
type JobRun ¶
type JobRun struct { // the unique name identifies the queue and eventhub, this avoids multiple people having colisions UniqueName string // the job run details JobRunName string JobCount int BatchCount int BatchID int // job start and end file information JobFileConfigSizeKB int // mount information MountParity bool // job queue information JobRunStartQueueName string WorkStartFileSizeKB int WorkStartFileCount int WorkCompleteFileSizeKB int WorkCompleteFileCount int WorkCompleteFailedFileSizeKB int WorkFailedProbability float64 DeleteFiles bool }
JobRun describes the details of a full job run including how many batches to break it into
func InitializeJobRunFromString ¶
InitializeJobRunFromString reads a jobrun from json string
type JobSubmitter ¶
type JobSubmitter struct { Context context.Context UniqueName string JobRunQueue *azure.Queue JobStartQueue *azure.Queue ThreadCount int PathManager *file.RoundRobinPathManager DirManager *file.DirectoryManager }
JobSubmitter defines the structure used for the job submitter process
func InitializeJobSubmitter ¶
func InitializeJobSubmitter( ctx context.Context, storageAccount string, storageKey string, uniqueName string, mountPaths []string, threadCount int) *JobSubmitter
InitializeJobSubmitter initializes the job submitter structure
func (*JobSubmitter) JobSubmitterWorkerRun ¶
func (j *JobSubmitter) JobSubmitterWorkerRun(syncWaitGroup *sync.WaitGroup, id int, batchName string, jobRun *JobRun, jobCount int)
JobSubmitterWorkerRun is the entry point for the JobSubmitter go routine
func (*JobSubmitter) Run ¶
func (j *JobSubmitter) Run(syncWaitGroup *sync.WaitGroup)
type Orchestrator ¶
type Orchestrator struct { Context context.Context UniqueName string JobStartQueue *azure.Queue WorkStartQueue *azure.Queue WorkComplete *azure.Queue JobComplete *azure.Queue PathManager *file.RoundRobinPathManager DirManager *file.DirectoryManager OrchestratorThreads int ReadyCh chan struct{} MsgCh chan *azqueue.DequeuedMessage }
Orchestrator defines the orchestrator structure
func InitializeOrchestrator ¶
func InitializeOrchestrator( ctx context.Context, storageAccount string, storageKey string, uniqueName string, mountPaths []string, orchestratorThreads int) *Orchestrator
InitializeOrchestrator initializes the Orchestrator
func (*Orchestrator) JobDispatcher ¶
func (o *Orchestrator) JobDispatcher(syncWaitGroup *sync.WaitGroup)
JobDispatcher dispatches jobs to workers based on input from the ready queue
func (*Orchestrator) Run ¶
func (o *Orchestrator) Run(syncWaitGroup *sync.WaitGroup)
Run implements the go routine entry point for the orchestrator. This starts the various go routines for managment of the queues
func (*Orchestrator) StartJobWorker ¶
func (o *Orchestrator) StartJobWorker(syncWaitGroup *sync.WaitGroup)
StartJobWorker implements the go routine of the worker that gets jobs from the queue
type StatsChannels ¶
type StatsChannels struct { ChJobProcessed chan struct{} ChProcessedFilesWritten chan struct{} ChJobCompleted chan struct{} ChUpload chan struct{} ChError chan struct{} }
StatsChannels defines the stats channels that counts queue stats
func GetStatsChannel ¶
func GetStatsChannel(ctx context.Context) *StatsChannels
GetStatsChannel gets the stats channel from the context
func InitializeStatsChannels ¶
func InitializeStatsChannels() *StatsChannels
InitializeStatsChannels initializes the stats channels
func (*StatsChannels) Error ¶
func (s *StatsChannels) Error()
Error signals that an error was encountered
func (*StatsChannels) JobCompleted ¶
func (s *StatsChannels) JobCompleted()
JobCompleted signals the job was completed and the file was written
func (*StatsChannels) JobProcessed ¶
func (s *StatsChannels) JobProcessed()
JobProcessed signals a job was processed
func (*StatsChannels) ProcessedFilesWritten ¶
func (s *StatsChannels) ProcessedFilesWritten()
ProcessedFilesWritten signals the worker start files were written
func (*StatsChannels) Upload ¶
func (s *StatsChannels) Upload()
Upload signals that an upload was queued
type WorkFileWriter ¶
WorkFileWriter handles the work start file and complete file creation for a single job
func InitializeWorkerFileWriter ¶
func InitializeWorkerFileWriter( jobConfigName string, jobRun *JobRun) *WorkFileWriter
InitializeWorkerFileWriter creates a work file writer for a single job
func ReadWorkFile ¶
func ReadWorkFile(reader *file.ReaderWriter, filename string) (*WorkFileWriter, error)
ReadWorkFile reads a work file from disk
func (*WorkFileWriter) FirstStartFile ¶
func (w *WorkFileWriter) FirstStartFile(filepath string) string
FirstStartFile returns the path of the first start file
func (*WorkFileWriter) WriteStartFiles ¶
func (w *WorkFileWriter) WriteStartFiles(writer *file.ReaderWriter, filepath string, fileSize int, fileCount int) error
WriteStartFiles writes the required number of start files