SlideShare una empresa de Scribd logo
1 de 81
Descargar para leer sin conexión
Opencast Job Dispatching
Greg Logan
gregorydlogan@gmail.com
February 15, 2018
Greg Logan February 15, 2018 1 / 30
Housekeeping
This is going to be a deeply technical talk
Greg Logan February 15, 2018 2 / 30
Housekeeping
This is going to be a deeply technical talk
If reality seems to be imploding...
Feel free to zone out for a bit
Ask questions
Greg Logan February 15, 2018 2 / 30
Housekeeping
This is going to be a deeply technical talk
If reality seems to be imploding...
Feel free to zone out for a bit
Ask questions
This presentation abuses UML
Greg Logan February 15, 2018 2 / 30
Housekeeping
This is going to be a deeply technical talk
If reality seems to be imploding...
Feel free to zone out for a bit
Ask questions
This presentation abuses UML
This is being recorded
Greg Logan February 15, 2018 2 / 30
Housekeeping
This is going to be a deeply technical talk
If reality seems to be imploding...
Feel free to zone out for a bit
Ask questions
This presentation abuses UML
This is being recorded
Shout questions as you think of them
Greg Logan February 15, 2018 2 / 30
Opencast Job Dispatching
Overview
Quick review: Services, and how they are registered
Anatomy of a job
How is a job created?
How does a job get dispatched?
What is a workflow? How does it differ from a job?
How is a workflow created?
(Relatively) complete workflow in steps, a descent into madness
Greg Logan February 15, 2018 3 / 30
Quick Review: Service and Service Registration
Opencast services register themselves with the service registry
This registry is local
The database synchronizes the registrations through the cluster
Local services talk directly to the local service registry
Remote services talk to their remote, which talks to its local registry
The architecture of how this all works was explained last talk
Greg Logan February 15, 2018 4 / 30
Anatomy of a Job
What is an Opencast Job?
Database object
Greg Logan February 15, 2018 5 / 30
Anatomy of a Job
What is an Opencast Job?
Database object
A representation of a unit of work within Opencast
Greg Logan February 15, 2018 5 / 30
Anatomy of a Job
What is an Opencast Job?
Database object
A representation of a unit of work within Opencast
A way to asynchronously keep track of your operations!
Greg Logan February 15, 2018 5 / 30
Anatomy of a Job
What is an Opencast Job?
Database object
A representation of a unit of work within Opencast
A way to asynchronously keep track of your operations!
Contains the data for a full operation (ie, encode of a stream)
Greg Logan February 15, 2018 5 / 30
Anatomy of a Job
What is an Opencast Job?
Database object
A representation of a unit of work within Opencast
A way to asynchronously keep track of your operations!
Contains the data for a full operation (ie, encode of a stream)
19 fields!
Status
Creating Service Type
Operation
Dispatchable
Job Load
Blocking Job
Blocked By
Greg Logan February 15, 2018 5 / 30
Job Creation
How is a job created?
A job is created by the service registry (SR) when an operation is
started
Greg Logan February 15, 2018 6 / 30
Job Creation
How is a job created?
A job is created by the service registry (SR) when an operation is
started
Each encode generates a job, as does each publish
Greg Logan February 15, 2018 6 / 30
Job Creation
How is a job created?
A job is created by the service registry (SR) when an operation is
started
Each encode generates a job, as does each publish
These jobs may spawn subjobs
An encode nearly always spawns an inspect job
Greg Logan February 15, 2018 6 / 30
Job Creation
How is a job created?
A job is created by the service registry (SR) when an operation is
started
Each encode generates a job, as does each publish
These jobs may spawn subjobs
An encode nearly always spawns an inspect job
Jobs can block waiting for their children
Greg Logan February 15, 2018 6 / 30
Job Creation
How is a job created?
A job is created by the service registry (SR) when an operation is
started
Each encode generates a job, as does each publish
These jobs may spawn subjobs
An encode nearly always spawns an inspect job
Jobs can block waiting for their children
Jobs can block waiting for resources(*)
Greg Logan February 15, 2018 6 / 30
Job Creation
How is a job created?
A job is created by the service registry (SR) when an operation is
started
Each encode generates a job, as does each publish
These jobs may spawn subjobs
An encode nearly always spawns an inspect job
Jobs can block waiting for their children
Jobs can block waiting for resources(*)
An undispatchable job is handled by the host which created it
Greg Logan February 15, 2018 6 / 30
Job Creation
How is a job created?
A job is created by the service registry (SR) when an operation is
started
Each encode generates a job, as does each publish
These jobs may spawn subjobs
An encode nearly always spawns an inspect job
Jobs can block waiting for their children
Jobs can block waiting for resources(*)
An undispatchable job is handled by the host which created it
Ingest
Greg Logan February 15, 2018 6 / 30
Job Dispatching: The basics
Job dispatching
This is where the sausage gets made
This is very simplified from the actual code
Greg Logan February 15, 2018 7 / 30
Job Dispatching: The (initial) sausage factory
function dispatchJobs(List[] jobs)
for all job in jobs do
serviceType ← job.serviceType
candidateServices ← getServicesOfType(serviceType)
serviceId ← dispatchJob(job, candidateServices)
function dispatchJob(Job job, List services)
for all service in services do
accepter ← HTTP.POST(job, service)
if accepter = null then return accepter.id
Greg Logan February 15, 2018 8 / 30
Job Dispatching: Weak Sausages
There are a number of issues here
Service fairness
Service load
Job load
Priority/Failed jobs
Greg Logan February 15, 2018 9 / 30
Job Dispatching: Service and Job Load
Job Load values
... are not the actual hardware cost to run a job
Greg Logan February 15, 2018 10 / 30
Job Dispatching: Service and Job Load
Job Load values
... are not the actual hardware cost to run a job
... are completely arbitrary
Greg Logan February 15, 2018 10 / 30
Job Dispatching: Service and Job Load
Job Load values
... are not the actual hardware cost to run a job
... are completely arbitrary
... should be thought of as a counter, rather than a load average
Greg Logan February 15, 2018 10 / 30
Job Dispatching: Service and Job Load
Service Load values
... are the sum of the Jobs currently in the RUNNING state
Greg Logan February 15, 2018 11 / 30
Job Dispatching: Service and Job Load
Service Load values
... are the sum of the Jobs currently in the RUNNING state
... do not represent the real load on the system
Greg Logan February 15, 2018 11 / 30
Job Dispatching: Service and Job Load
So what’s the point of the load value?
Each node/host defines a maximum load for itself
Typically this is equal to the number of processor cores
Greg Logan February 15, 2018 12 / 30
Job Dispatching: Service and Job Load
So what’s the point of the load value?
Each node/host defines a maximum load for itself
Typically this is equal to the number of processor cores
The node will be assigned at most that much load
Greg Logan February 15, 2018 12 / 30
Job Dispatching: Service and Job Load
So what’s the point of the load value?
Each node/host defines a maximum load for itself
Typically this is equal to the number of processor cores
The node will be assigned at most that much load
(jobs.load) <= node.maxload
Greg Logan February 15, 2018 12 / 30
Job Dispatching: Service and Job Load
So what’s the point of the load value?
Each node/host defines a maximum load for itself
Typically this is equal to the number of processor cores
The node will be assigned at most that much load
(jobs.load) <= node.maxload
If node.maxload = 8
job.load = 2 → 4 jobs
job.load = 4 → 2 jobs
job.load > 4 → 1 jobs
Greg Logan February 15, 2018 12 / 30
Job Dispatching: Service and Job Load
So what’s the point of the load value?
Each node/host defines a maximum load for itself
Typically this is equal to the number of processor cores
The node will be assigned at most that much load
(jobs.load) <= node.maxload
If node.maxload = 8
job.load = 2 → 4 jobs
job.load = 4 → 2 jobs
job.load > 4 → 1 jobs
Job load can be fractional!
Greg Logan February 15, 2018 12 / 30
Job Dispatching: Service and Job Load
So what’s the point of the load value?
Each node/host defines a maximum load for itself
Typically this is equal to the number of processor cores
The node will be assigned at most that much load
(jobs.load) <= node.maxload
If node.maxload = 8
job.load = 2 → 4 jobs
job.load = 4 → 2 jobs
job.load > 4 → 1 jobs
Job load can be fractional!
Job load can be negative!
Greg Logan February 15, 2018 12 / 30
Job Dispatching: Service and Job Load
So what’s the point of the load value?
Each node/host defines a maximum load for itself
Typically this is equal to the number of processor cores
The node will be assigned at most that much load
(jobs.load) <= node.maxload
If node.maxload = 8
job.load = 2 → 4 jobs
job.load = 4 → 2 jobs
job.load > 4 → 1 jobs
Job load can be fractional!
Job load can be negative!
Don’t do this...
Greg Logan February 15, 2018 12 / 30
Job Dispatching: Service and Job Load
Aside: Neat Tricks
Specialist nodes
Greg Logan February 15, 2018 13 / 30
Job Dispatching: Service and Job Load
Aside: Neat Tricks
Specialist nodes
Really really good at one thing
Greg Logan February 15, 2018 13 / 30
Job Dispatching: Service and Job Load
Aside: Neat Tricks
Specialist nodes
Really really good at one thing
Set that job’s cost to very small (zero?)
Greg Logan February 15, 2018 13 / 30
Job Dispatching: Service and Job Load
Aside: Neat Tricks
Specialist nodes
Really really good at one thing
Set that job’s cost to very small (zero?)
Set that job’s cost to greater than node.maxload everywhere else
Greg Logan February 15, 2018 13 / 30
Job Dispatching: Service and Job Load
Aside: Neat Tricks
Specialist nodes
Really really good at one thing
Set that job’s cost to very small (zero?)
Set that job’s cost to greater than node.maxload everywhere else
Set the rest of the costs to greater than node.maxload
Greg Logan February 15, 2018 13 / 30
Job Dispatching: Service and Job Load
Aside: Neat Tricks
Specialist nodes
Really really good at one thing
Set that job’s cost to very small (zero?)
Set that job’s cost to greater than node.maxload everywhere else
Set the rest of the costs to greater than node.maxload
That job will only run on that hardware
Greg Logan February 15, 2018 13 / 30
Job Dispatching: Service and Job Load
Aside: Neat Tricks
Specialist nodes
Really really good at one thing
Set that job’s cost to very small (zero?)
Set that job’s cost to greater than node.maxload everywhere else
Set the rest of the costs to greater than node.maxload
That job will only run on that hardware
This can block processing!
Greg Logan February 15, 2018 13 / 30
Job Dispatching: Service and Job Load
Aside: Neat Tricks
Specialist nodes
Really really good at one thing
Set that job’s cost to very small (zero?)
Set that job’s cost to greater than node.maxload everywhere else
Set the rest of the costs to greater than node.maxload
That job will only run on that hardware
This can block processing!
Current bug: Cheaper encoding not prioritized (MH-12493)
Greg Logan February 15, 2018 13 / 30
Job Dispatching: Service and Job Load
Taking the safeties off
Each node/host defines a maximum load for itself
Greg Logan February 15, 2018 14 / 30
Job Dispatching: Service and Job Load
Taking the safeties off
Each node/host defines a maximum load for itself
If the cost for a job exceeds maxload for all nodes the job never
processes
Greg Logan February 15, 2018 14 / 30
Job Dispatching: Service and Job Load
Taking the safeties off
Each node/host defines a maximum load for itself
If the cost for a job exceeds maxload for all nodes the job never
processes
org.opencastproject.job.load.acceptexceeding
Greg Logan February 15, 2018 14 / 30
Job Dispatching: Service and Job Load
Taking the safeties off
Each node/host defines a maximum load for itself
If the cost for a job exceeds maxload for all nodes the job never
processes
org.opencastproject.job.load.acceptexceeding
This is true by default
Greg Logan February 15, 2018 14 / 30
Job Dispatching: Service and Job Load
Taking the safeties off
Each node/host defines a maximum load for itself
If the cost for a job exceeds maxload for all nodes the job never
processes
org.opencastproject.job.load.acceptexceeding
This is true by default
Setting this to false is safe
Greg Logan February 15, 2018 14 / 30
Job Dispatching: Service and Job Load
Taking the safeties off
Each node/host defines a maximum load for itself
If the cost for a job exceeds maxload for all nodes the job never
processes
org.opencastproject.job.load.acceptexceeding
This is true by default
Setting this to false is safe
Set this to false prior to changing job loads
Greg Logan February 15, 2018 14 / 30
Job Dispatching: Accounting for Load
function mainDispatch( )
repeat
jobs ← getAllJobs( )
dispatchJobs(jobs)
until shutdown
function dispatchJobs(List[] jobs)
for all job in jobs do
serviceType ← job.serviceType
candidateServices ← getServicesOfType(serviceType)
candidateServices ← filterServicesByLoad(job.load)
serviceId ← dispatchJob(job, candidateServices)
Greg Logan February 15, 2018 15 / 30
Job Dispatching: Priority
One thing people always want:
How can I make this recording process in front of that one?
Greg Logan February 15, 2018 16 / 30
Job Dispatching: Priority
One thing people always want:
How can I make this recording process in front of that one?
This isn’t that
Greg Logan February 15, 2018 16 / 30
Job Dispatching: Priority
One thing people always want:
How can I make this recording process in front of that one?
This isn’t that
MH-6850
Greg Logan February 15, 2018 16 / 30
Job Dispatching: Priority
One thing people always want:
How can I make this recording process in front of that one?
This isn’t that
MH-6850
This is for handling undispatchable, failed, and queued jobs
Greg Logan February 15, 2018 16 / 30
Job Dispatching: Priority
One thing people always want:
How can I make this recording process in front of that one?
This isn’t that
MH-6850
This is for handling undispatchable, failed, and queued jobs
Undispatchable: No service accepted them
Greg Logan February 15, 2018 16 / 30
Job Dispatching: Priority
One thing people always want:
How can I make this recording process in front of that one?
This isn’t that
MH-6850
This is for handling undispatchable, failed, and queued jobs
Undispatchable: No service accepted them
Failed: Did not complete successfully
Greg Logan February 15, 2018 16 / 30
Job Dispatching: Priority
One thing people always want:
How can I make this recording process in front of that one?
This isn’t that
MH-6850
This is for handling undispatchable, failed, and queued jobs
Undispatchable: No service accepted them
Failed: Did not complete successfully
Queued: New jobs
Greg Logan February 15, 2018 16 / 30
Job Dispatching: Accounting for Priority
function mainDispatch( )
repeat
jobs ← getPriorityJobs( )
dispatchJobs(jobs)
jobs ← getRestartJobs( )
dispatchJobs(jobs)
jobs ← getQueuedJobs( )
dispatchJobs(jobs)
jobs ← getAllJobs( )
dispatchJobs(jobs)
until shutdown
Greg Logan February 15, 2018 17 / 30
On to workflows
What is a workflow
It’s a recording?
Greg Logan February 15, 2018 18 / 30
On to workflows
What is a workflow
It’s a recording?
It’s a processing run for a recording?
Greg Logan February 15, 2018 18 / 30
On to workflows
What is a workflow
It’s a recording?
It’s a processing run for a recording?
It’s a collection of jobs
Greg Logan February 15, 2018 18 / 30
On to workflows
What is a workflow
It’s a recording?
It’s a processing run for a recording?
It’s a collection of jobs
It’s a job with some metadata
Greg Logan February 15, 2018 18 / 30
The Workflow Service
The Workflow Service
Keeps track of all workflows
Greg Logan February 15, 2018 19 / 30
The Workflow Service
The Workflow Service
Keeps track of all workflows
Organizes the creation of jobs
Greg Logan February 15, 2018 19 / 30
The Workflow Service
The Workflow Service
Keeps track of all workflows
Organizes the creation of jobs
Organizes the sequence of jobs
Greg Logan February 15, 2018 19 / 30
The Workflow Service
The Workflow Service
Keeps track of all workflows
Organizes the creation of jobs
Organizes the sequence of jobs
Note that this is creation, not execution
Greg Logan February 15, 2018 19 / 30
The Workflow Service
The Workflow Service
Keeps track of all workflows
Organizes the creation of jobs
Organizes the sequence of jobs
Note that this is creation, not execution
The origin point of all work in the system
Greg Logan February 15, 2018 19 / 30
So how does this work?
Who calls the workflow service?
You do
Created via the admin UI
Created via ingest
You get a WorkflowInstance
Updating the workflow service takes the job ID!
Greg Logan February 15, 2018 20 / 30
What does this look like?
User AdminUI WorkflowService ServiceRegistry
Start
.Start()
.createJob
Greg Logan February 15, 2018 21 / 30
Wait, what?
Some of you might have noticed that the previous sequence has problems
It just creates a job, then it stops
Greg Logan February 15, 2018 22 / 30
Wait, what?
Some of you might have noticed that the previous sequence has problems
It just creates a job, then it stops
It does not actually do any processing
Greg Logan February 15, 2018 22 / 30
Wait, what?
Some of you might have noticed that the previous sequence has problems
It just creates a job, then it stops
It does not actually do any processing
That’s because your workflow is a job
Job type: workflow
Job operation START WORKFLOW
This gets dispatched just like any other job
Greg Logan February 15, 2018 22 / 30
What does this look like?
User AdminUI WorkflowService ServiceRegistry
Start
.Start()
.createJob(ST WORKFLOW)
Greg Logan February 15, 2018 23 / 30
What does this look like?
ServiceRegistry WorkflowService
.createJob(START WORKFLOW)
.process()
Greg Logan February 15, 2018 24 / 30
What does this look like?
ServiceRegistry WorkflowService
.createJob(START WORKFLOW)
.process()
.createJob(START OPERATION)
Greg Logan February 15, 2018 25 / 30
But wait, there’s more!
It begins
Everything is a job
It’s jobs all the way down
What is START OPERATION?
Greg Logan February 15, 2018 26 / 30
But wait, there’s more!
It begins
Everything is a job
It’s jobs all the way down
What is START OPERATION?
It is a Workflow Job
Greg Logan February 15, 2018 26 / 30
We need to go deeper...
ServiceRegistry WorkflowService
.createJob(START WORKFLOW)
.process()
.createJob(START OPERATION)
Greg Logan February 15, 2018 27 / 30
We need to go deeper...
ServiceRegistry WorkflowService SomeService
createJob(START WORKFLOW)
.process()
.createJob(START OPERATION)
process
LoopLoop For each workflow step
Greg Logan February 15, 2018 28 / 30
And deeper...
ServiceRegistry WorkflowService SomeWOH SomeService
.process()
.createJob()
process
.start()
.foo()
LoopLoop For each workflow step
Greg Logan February 15, 2018 29 / 30
Wrapup
This was a long, complex talk
I hope I was clear
Please ask any questions you might have
This was actually simplified, there are at least two layers
missing
Bonus points if you can guess what they are!
Greg Logan February 15, 2018 30 / 30

Más contenido relacionado

Último

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Último (20)

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 

Destacado

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Opencast Job Dispatching

  • 1. Opencast Job Dispatching Greg Logan gregorydlogan@gmail.com February 15, 2018 Greg Logan February 15, 2018 1 / 30
  • 2. Housekeeping This is going to be a deeply technical talk Greg Logan February 15, 2018 2 / 30
  • 3. Housekeeping This is going to be a deeply technical talk If reality seems to be imploding... Feel free to zone out for a bit Ask questions Greg Logan February 15, 2018 2 / 30
  • 4. Housekeeping This is going to be a deeply technical talk If reality seems to be imploding... Feel free to zone out for a bit Ask questions This presentation abuses UML Greg Logan February 15, 2018 2 / 30
  • 5. Housekeeping This is going to be a deeply technical talk If reality seems to be imploding... Feel free to zone out for a bit Ask questions This presentation abuses UML This is being recorded Greg Logan February 15, 2018 2 / 30
  • 6. Housekeeping This is going to be a deeply technical talk If reality seems to be imploding... Feel free to zone out for a bit Ask questions This presentation abuses UML This is being recorded Shout questions as you think of them Greg Logan February 15, 2018 2 / 30
  • 7. Opencast Job Dispatching Overview Quick review: Services, and how they are registered Anatomy of a job How is a job created? How does a job get dispatched? What is a workflow? How does it differ from a job? How is a workflow created? (Relatively) complete workflow in steps, a descent into madness Greg Logan February 15, 2018 3 / 30
  • 8. Quick Review: Service and Service Registration Opencast services register themselves with the service registry This registry is local The database synchronizes the registrations through the cluster Local services talk directly to the local service registry Remote services talk to their remote, which talks to its local registry The architecture of how this all works was explained last talk Greg Logan February 15, 2018 4 / 30
  • 9. Anatomy of a Job What is an Opencast Job? Database object Greg Logan February 15, 2018 5 / 30
  • 10. Anatomy of a Job What is an Opencast Job? Database object A representation of a unit of work within Opencast Greg Logan February 15, 2018 5 / 30
  • 11. Anatomy of a Job What is an Opencast Job? Database object A representation of a unit of work within Opencast A way to asynchronously keep track of your operations! Greg Logan February 15, 2018 5 / 30
  • 12. Anatomy of a Job What is an Opencast Job? Database object A representation of a unit of work within Opencast A way to asynchronously keep track of your operations! Contains the data for a full operation (ie, encode of a stream) Greg Logan February 15, 2018 5 / 30
  • 13. Anatomy of a Job What is an Opencast Job? Database object A representation of a unit of work within Opencast A way to asynchronously keep track of your operations! Contains the data for a full operation (ie, encode of a stream) 19 fields! Status Creating Service Type Operation Dispatchable Job Load Blocking Job Blocked By Greg Logan February 15, 2018 5 / 30
  • 14. Job Creation How is a job created? A job is created by the service registry (SR) when an operation is started Greg Logan February 15, 2018 6 / 30
  • 15. Job Creation How is a job created? A job is created by the service registry (SR) when an operation is started Each encode generates a job, as does each publish Greg Logan February 15, 2018 6 / 30
  • 16. Job Creation How is a job created? A job is created by the service registry (SR) when an operation is started Each encode generates a job, as does each publish These jobs may spawn subjobs An encode nearly always spawns an inspect job Greg Logan February 15, 2018 6 / 30
  • 17. Job Creation How is a job created? A job is created by the service registry (SR) when an operation is started Each encode generates a job, as does each publish These jobs may spawn subjobs An encode nearly always spawns an inspect job Jobs can block waiting for their children Greg Logan February 15, 2018 6 / 30
  • 18. Job Creation How is a job created? A job is created by the service registry (SR) when an operation is started Each encode generates a job, as does each publish These jobs may spawn subjobs An encode nearly always spawns an inspect job Jobs can block waiting for their children Jobs can block waiting for resources(*) Greg Logan February 15, 2018 6 / 30
  • 19. Job Creation How is a job created? A job is created by the service registry (SR) when an operation is started Each encode generates a job, as does each publish These jobs may spawn subjobs An encode nearly always spawns an inspect job Jobs can block waiting for their children Jobs can block waiting for resources(*) An undispatchable job is handled by the host which created it Greg Logan February 15, 2018 6 / 30
  • 20. Job Creation How is a job created? A job is created by the service registry (SR) when an operation is started Each encode generates a job, as does each publish These jobs may spawn subjobs An encode nearly always spawns an inspect job Jobs can block waiting for their children Jobs can block waiting for resources(*) An undispatchable job is handled by the host which created it Ingest Greg Logan February 15, 2018 6 / 30
  • 21. Job Dispatching: The basics Job dispatching This is where the sausage gets made This is very simplified from the actual code Greg Logan February 15, 2018 7 / 30
  • 22. Job Dispatching: The (initial) sausage factory function dispatchJobs(List[] jobs) for all job in jobs do serviceType ← job.serviceType candidateServices ← getServicesOfType(serviceType) serviceId ← dispatchJob(job, candidateServices) function dispatchJob(Job job, List services) for all service in services do accepter ← HTTP.POST(job, service) if accepter = null then return accepter.id Greg Logan February 15, 2018 8 / 30
  • 23. Job Dispatching: Weak Sausages There are a number of issues here Service fairness Service load Job load Priority/Failed jobs Greg Logan February 15, 2018 9 / 30
  • 24. Job Dispatching: Service and Job Load Job Load values ... are not the actual hardware cost to run a job Greg Logan February 15, 2018 10 / 30
  • 25. Job Dispatching: Service and Job Load Job Load values ... are not the actual hardware cost to run a job ... are completely arbitrary Greg Logan February 15, 2018 10 / 30
  • 26. Job Dispatching: Service and Job Load Job Load values ... are not the actual hardware cost to run a job ... are completely arbitrary ... should be thought of as a counter, rather than a load average Greg Logan February 15, 2018 10 / 30
  • 27. Job Dispatching: Service and Job Load Service Load values ... are the sum of the Jobs currently in the RUNNING state Greg Logan February 15, 2018 11 / 30
  • 28. Job Dispatching: Service and Job Load Service Load values ... are the sum of the Jobs currently in the RUNNING state ... do not represent the real load on the system Greg Logan February 15, 2018 11 / 30
  • 29. Job Dispatching: Service and Job Load So what’s the point of the load value? Each node/host defines a maximum load for itself Typically this is equal to the number of processor cores Greg Logan February 15, 2018 12 / 30
  • 30. Job Dispatching: Service and Job Load So what’s the point of the load value? Each node/host defines a maximum load for itself Typically this is equal to the number of processor cores The node will be assigned at most that much load Greg Logan February 15, 2018 12 / 30
  • 31. Job Dispatching: Service and Job Load So what’s the point of the load value? Each node/host defines a maximum load for itself Typically this is equal to the number of processor cores The node will be assigned at most that much load (jobs.load) <= node.maxload Greg Logan February 15, 2018 12 / 30
  • 32. Job Dispatching: Service and Job Load So what’s the point of the load value? Each node/host defines a maximum load for itself Typically this is equal to the number of processor cores The node will be assigned at most that much load (jobs.load) <= node.maxload If node.maxload = 8 job.load = 2 → 4 jobs job.load = 4 → 2 jobs job.load > 4 → 1 jobs Greg Logan February 15, 2018 12 / 30
  • 33. Job Dispatching: Service and Job Load So what’s the point of the load value? Each node/host defines a maximum load for itself Typically this is equal to the number of processor cores The node will be assigned at most that much load (jobs.load) <= node.maxload If node.maxload = 8 job.load = 2 → 4 jobs job.load = 4 → 2 jobs job.load > 4 → 1 jobs Job load can be fractional! Greg Logan February 15, 2018 12 / 30
  • 34. Job Dispatching: Service and Job Load So what’s the point of the load value? Each node/host defines a maximum load for itself Typically this is equal to the number of processor cores The node will be assigned at most that much load (jobs.load) <= node.maxload If node.maxload = 8 job.load = 2 → 4 jobs job.load = 4 → 2 jobs job.load > 4 → 1 jobs Job load can be fractional! Job load can be negative! Greg Logan February 15, 2018 12 / 30
  • 35. Job Dispatching: Service and Job Load So what’s the point of the load value? Each node/host defines a maximum load for itself Typically this is equal to the number of processor cores The node will be assigned at most that much load (jobs.load) <= node.maxload If node.maxload = 8 job.load = 2 → 4 jobs job.load = 4 → 2 jobs job.load > 4 → 1 jobs Job load can be fractional! Job load can be negative! Don’t do this... Greg Logan February 15, 2018 12 / 30
  • 36. Job Dispatching: Service and Job Load Aside: Neat Tricks Specialist nodes Greg Logan February 15, 2018 13 / 30
  • 37. Job Dispatching: Service and Job Load Aside: Neat Tricks Specialist nodes Really really good at one thing Greg Logan February 15, 2018 13 / 30
  • 38. Job Dispatching: Service and Job Load Aside: Neat Tricks Specialist nodes Really really good at one thing Set that job’s cost to very small (zero?) Greg Logan February 15, 2018 13 / 30
  • 39. Job Dispatching: Service and Job Load Aside: Neat Tricks Specialist nodes Really really good at one thing Set that job’s cost to very small (zero?) Set that job’s cost to greater than node.maxload everywhere else Greg Logan February 15, 2018 13 / 30
  • 40. Job Dispatching: Service and Job Load Aside: Neat Tricks Specialist nodes Really really good at one thing Set that job’s cost to very small (zero?) Set that job’s cost to greater than node.maxload everywhere else Set the rest of the costs to greater than node.maxload Greg Logan February 15, 2018 13 / 30
  • 41. Job Dispatching: Service and Job Load Aside: Neat Tricks Specialist nodes Really really good at one thing Set that job’s cost to very small (zero?) Set that job’s cost to greater than node.maxload everywhere else Set the rest of the costs to greater than node.maxload That job will only run on that hardware Greg Logan February 15, 2018 13 / 30
  • 42. Job Dispatching: Service and Job Load Aside: Neat Tricks Specialist nodes Really really good at one thing Set that job’s cost to very small (zero?) Set that job’s cost to greater than node.maxload everywhere else Set the rest of the costs to greater than node.maxload That job will only run on that hardware This can block processing! Greg Logan February 15, 2018 13 / 30
  • 43. Job Dispatching: Service and Job Load Aside: Neat Tricks Specialist nodes Really really good at one thing Set that job’s cost to very small (zero?) Set that job’s cost to greater than node.maxload everywhere else Set the rest of the costs to greater than node.maxload That job will only run on that hardware This can block processing! Current bug: Cheaper encoding not prioritized (MH-12493) Greg Logan February 15, 2018 13 / 30
  • 44. Job Dispatching: Service and Job Load Taking the safeties off Each node/host defines a maximum load for itself Greg Logan February 15, 2018 14 / 30
  • 45. Job Dispatching: Service and Job Load Taking the safeties off Each node/host defines a maximum load for itself If the cost for a job exceeds maxload for all nodes the job never processes Greg Logan February 15, 2018 14 / 30
  • 46. Job Dispatching: Service and Job Load Taking the safeties off Each node/host defines a maximum load for itself If the cost for a job exceeds maxload for all nodes the job never processes org.opencastproject.job.load.acceptexceeding Greg Logan February 15, 2018 14 / 30
  • 47. Job Dispatching: Service and Job Load Taking the safeties off Each node/host defines a maximum load for itself If the cost for a job exceeds maxload for all nodes the job never processes org.opencastproject.job.load.acceptexceeding This is true by default Greg Logan February 15, 2018 14 / 30
  • 48. Job Dispatching: Service and Job Load Taking the safeties off Each node/host defines a maximum load for itself If the cost for a job exceeds maxload for all nodes the job never processes org.opencastproject.job.load.acceptexceeding This is true by default Setting this to false is safe Greg Logan February 15, 2018 14 / 30
  • 49. Job Dispatching: Service and Job Load Taking the safeties off Each node/host defines a maximum load for itself If the cost for a job exceeds maxload for all nodes the job never processes org.opencastproject.job.load.acceptexceeding This is true by default Setting this to false is safe Set this to false prior to changing job loads Greg Logan February 15, 2018 14 / 30
  • 50. Job Dispatching: Accounting for Load function mainDispatch( ) repeat jobs ← getAllJobs( ) dispatchJobs(jobs) until shutdown function dispatchJobs(List[] jobs) for all job in jobs do serviceType ← job.serviceType candidateServices ← getServicesOfType(serviceType) candidateServices ← filterServicesByLoad(job.load) serviceId ← dispatchJob(job, candidateServices) Greg Logan February 15, 2018 15 / 30
  • 51. Job Dispatching: Priority One thing people always want: How can I make this recording process in front of that one? Greg Logan February 15, 2018 16 / 30
  • 52. Job Dispatching: Priority One thing people always want: How can I make this recording process in front of that one? This isn’t that Greg Logan February 15, 2018 16 / 30
  • 53. Job Dispatching: Priority One thing people always want: How can I make this recording process in front of that one? This isn’t that MH-6850 Greg Logan February 15, 2018 16 / 30
  • 54. Job Dispatching: Priority One thing people always want: How can I make this recording process in front of that one? This isn’t that MH-6850 This is for handling undispatchable, failed, and queued jobs Greg Logan February 15, 2018 16 / 30
  • 55. Job Dispatching: Priority One thing people always want: How can I make this recording process in front of that one? This isn’t that MH-6850 This is for handling undispatchable, failed, and queued jobs Undispatchable: No service accepted them Greg Logan February 15, 2018 16 / 30
  • 56. Job Dispatching: Priority One thing people always want: How can I make this recording process in front of that one? This isn’t that MH-6850 This is for handling undispatchable, failed, and queued jobs Undispatchable: No service accepted them Failed: Did not complete successfully Greg Logan February 15, 2018 16 / 30
  • 57. Job Dispatching: Priority One thing people always want: How can I make this recording process in front of that one? This isn’t that MH-6850 This is for handling undispatchable, failed, and queued jobs Undispatchable: No service accepted them Failed: Did not complete successfully Queued: New jobs Greg Logan February 15, 2018 16 / 30
  • 58. Job Dispatching: Accounting for Priority function mainDispatch( ) repeat jobs ← getPriorityJobs( ) dispatchJobs(jobs) jobs ← getRestartJobs( ) dispatchJobs(jobs) jobs ← getQueuedJobs( ) dispatchJobs(jobs) jobs ← getAllJobs( ) dispatchJobs(jobs) until shutdown Greg Logan February 15, 2018 17 / 30
  • 59. On to workflows What is a workflow It’s a recording? Greg Logan February 15, 2018 18 / 30
  • 60. On to workflows What is a workflow It’s a recording? It’s a processing run for a recording? Greg Logan February 15, 2018 18 / 30
  • 61. On to workflows What is a workflow It’s a recording? It’s a processing run for a recording? It’s a collection of jobs Greg Logan February 15, 2018 18 / 30
  • 62. On to workflows What is a workflow It’s a recording? It’s a processing run for a recording? It’s a collection of jobs It’s a job with some metadata Greg Logan February 15, 2018 18 / 30
  • 63. The Workflow Service The Workflow Service Keeps track of all workflows Greg Logan February 15, 2018 19 / 30
  • 64. The Workflow Service The Workflow Service Keeps track of all workflows Organizes the creation of jobs Greg Logan February 15, 2018 19 / 30
  • 65. The Workflow Service The Workflow Service Keeps track of all workflows Organizes the creation of jobs Organizes the sequence of jobs Greg Logan February 15, 2018 19 / 30
  • 66. The Workflow Service The Workflow Service Keeps track of all workflows Organizes the creation of jobs Organizes the sequence of jobs Note that this is creation, not execution Greg Logan February 15, 2018 19 / 30
  • 67. The Workflow Service The Workflow Service Keeps track of all workflows Organizes the creation of jobs Organizes the sequence of jobs Note that this is creation, not execution The origin point of all work in the system Greg Logan February 15, 2018 19 / 30
  • 68. So how does this work? Who calls the workflow service? You do Created via the admin UI Created via ingest You get a WorkflowInstance Updating the workflow service takes the job ID! Greg Logan February 15, 2018 20 / 30
  • 69. What does this look like? User AdminUI WorkflowService ServiceRegistry Start .Start() .createJob Greg Logan February 15, 2018 21 / 30
  • 70. Wait, what? Some of you might have noticed that the previous sequence has problems It just creates a job, then it stops Greg Logan February 15, 2018 22 / 30
  • 71. Wait, what? Some of you might have noticed that the previous sequence has problems It just creates a job, then it stops It does not actually do any processing Greg Logan February 15, 2018 22 / 30
  • 72. Wait, what? Some of you might have noticed that the previous sequence has problems It just creates a job, then it stops It does not actually do any processing That’s because your workflow is a job Job type: workflow Job operation START WORKFLOW This gets dispatched just like any other job Greg Logan February 15, 2018 22 / 30
  • 73. What does this look like? User AdminUI WorkflowService ServiceRegistry Start .Start() .createJob(ST WORKFLOW) Greg Logan February 15, 2018 23 / 30
  • 74. What does this look like? ServiceRegistry WorkflowService .createJob(START WORKFLOW) .process() Greg Logan February 15, 2018 24 / 30
  • 75. What does this look like? ServiceRegistry WorkflowService .createJob(START WORKFLOW) .process() .createJob(START OPERATION) Greg Logan February 15, 2018 25 / 30
  • 76. But wait, there’s more! It begins Everything is a job It’s jobs all the way down What is START OPERATION? Greg Logan February 15, 2018 26 / 30
  • 77. But wait, there’s more! It begins Everything is a job It’s jobs all the way down What is START OPERATION? It is a Workflow Job Greg Logan February 15, 2018 26 / 30
  • 78. We need to go deeper... ServiceRegistry WorkflowService .createJob(START WORKFLOW) .process() .createJob(START OPERATION) Greg Logan February 15, 2018 27 / 30
  • 79. We need to go deeper... ServiceRegistry WorkflowService SomeService createJob(START WORKFLOW) .process() .createJob(START OPERATION) process LoopLoop For each workflow step Greg Logan February 15, 2018 28 / 30
  • 80. And deeper... ServiceRegistry WorkflowService SomeWOH SomeService .process() .createJob() process .start() .foo() LoopLoop For each workflow step Greg Logan February 15, 2018 29 / 30
  • 81. Wrapup This was a long, complex talk I hope I was clear Please ask any questions you might have This was actually simplified, there are at least two layers missing Bonus points if you can guess what they are! Greg Logan February 15, 2018 30 / 30