sched | a high performance reliable task scheduling package in Go | Job Scheduling library
kandi X-RAY | sched Summary
kandi X-RAY | sched Summary
sched is a high performance task scheduling library with future support.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Stop stops the scheduler
- Init initializes the cache with the given parameters .
- save record to database .
- getRecords returns the cache ids
- pause stops the timer .
- newTaskItem creates a new task item
- newCache returns a new cache instance .
- Wait waits for all tasks to finish .
- newTaskQueue creates a new task queue .
- Pause stops the scheduler .
sched Key Features
sched Examples and Code Snippets
// Init sched, with tasks should recovered when reboot
futures, err := sched.Init(
"redis://127.0.0.1:6379/1",
&ArbitraryTask1{},
&ArbitraryTask2{},
)
if err != nil {
panic(err)
}
// Retrieve task's future
for i := range fut
Community Discussions
Trending Discussions on sched
QUESTION
My title is not great because I'm having trouble articulating my question. Basically, I have a DateFrame with transactional data consisting of a few DateTime columns and a value column. I need to apply filters to the dates and sum the resulting values in a new DataFrame.
Here is a simplified version of my DateFrame df
:
ANSWER
Answered 2021-Sep-28 at 02:00I kept digging and found a solution to my question with a lot of help from this answer from kait
QUESTION
These flags are defined in kernel/sched/sched.h and are used when enabling/disabling migration for a task in core.c. I haven't been able to determine what SCA is short for from looking at the code or patch notes.
...ANSWER
Answered 2022-Mar-03 at 21:40I spent two hours trying to dig it up from kernel's Git history and it seems the first apparition of this prefix starts from commit 9cfc3e18adb0362533e911bf3ce6ec8c821cfccc, which says :
sched: Massage set_cpus_allowed()
Thread a u32 flags word through the set_cpus_allowed () callchain. This will allow adding behavioural tweaks for future users.
I believe this is what it means.
QUESTION
I have this simple self-contained example of a very rudimentary 2 dimensional stencil application using OpenMP tasks on dynamic arrays to represent an issue that I am having on a problem that is less of a toy problem.
There are 2 update steps in which for each point in the array 3 values are added from another array, from the corresponding location as well as the upper and lower neighbour location. The program is executed on a NUMA CPU with 8 cores and 2 hardware threads on each NUMA node. The array initializations are parallelized and using the environment variables OMP_PLACES=threads
and OMP_PROC_BIND=spread
the data is evenly distributed among the nodes' memories. To avoid data races I have set up dependencies so that for every section on the second update a task can only be scheduled if the relevant tasks for the sections from the first update step are executed. The computation is correct but not NUMA aware. The affinity clause seems to be not enough to change the scheduling as it is just a hint. I am also not sure whether using the single
for task creation is efficient but all I know is it is the only way to make all task sibling tasks and thus the dependencies applicable.
Is there a way in OpenMP where I could parallelize the task creation under these constraints or guide the runtime system to a more NUMA-aware task scheduling? If not, it is also okay, I am just trying to see whether there are options available that use OpenMP in a way that it is intended and not trying to break it. I already have a version that only uses worksharing loops. This is for research.
NUMA NODE 0 pus {0-7,16-23} NUMA NODE 1 pus {8-15,24-31}
Environment Variables
...ANSWER
Answered 2022-Feb-27 at 13:36First of all, the state of the OpenMP task scheduling on NUMA systems is far from being great in practice. It has been the subject of many research project in the past and they is still ongoing project working on it. Some research runtimes consider the affinity hint properly and schedule the tasks regarding the NUMA node of the in/out/inout dependencies. However, AFAIK mainstream runtimes does not do much to schedule tasks well on NUMA systems, especially if you create all the tasks from a unique NUMA node. Indeed, AFAIK GOMP (GCC) just ignore this and actually exhibit a behavior that make it inefficient on NUMA systems (eg. the creation of the tasks is temporary stopped when there are too many of them and tasks are executed on all NUMA nodes disregarding the source/target NUMA node). IOMP (Clang/ICC) takes into account locality but AFAIK in your case, the scheduling should not be great. The affinity hint for tasks is not available upstream yet. Thus, GOMP and IOMP will clearly not behave well in your case as tasks of different steps will be often distributed in a way that produces many remote NUMA node accesses that are known to be inefficient. In fact, this is critical in your case as stencils are generally memory bound.
If you work with IOMP, be aware that its task scheduler tends to execute tasks on the same NUMA node where they are created. Thus, a good solution is to create the tasks in parallel. The tasks can be created in many threads bound to NUMA nodes. The scheduler will first try to execute the tasks on the same threads. Workers on the same NUMA node will try to steal tasks of the threads in the same NUMA node, and if there not enough tasks, then from any threads. While this work stealing strategy works relatively well in practice, there is a huge catch: tasks of different parent tasks cannot share dependencies. This limitation of the current OpenMP specification is a big issue for stencil codes (at least the ones that creates tasks working on different time steps). An alternative solution is to create tasks with dependencies from one thread and create smaller tasks from these tasks but due to the often bad scheduling of the big tasks, this approach is generally inefficient in practice on NUMA systems. In practice, on mainstream runtimes, the basic statically-scheduled loops behave relatively well on NUMA system for stencil although it is clearly sub-optimal for large stencils. This is sad and I hope this situation will improve in the current decade.
Be aware that data initialization matters a lot on NUMA systems as many platform actually allocate pages on the NUMA node performing the first touch. Thus the initialization has to be parallel (otherwise all the pages could be located on the same NUMA node causing a saturation of this node during stencil steps). The default policy is not the same on all platforms and some can move pages between NUMA nodes regarding their use. You can tweak the behavior with numactl
. You can also fetch very useful information from the hw-loc
tool. I strongly advise you to manually the location of all OpenMP threads using OMP_PROC_BIND=True
and OMP_PLACES="{0},{1},...,{n}"
where the OMP_PLACES
string set can be generated from hw-loc
regarding the actual platform.
For more information you can read this research paper (disclaimer: I am one of the authors). You can certainly find other similar research paper on the IWOMP conference and the Super-Computing conference too. You could try to use research runtime though most of them are not designed to be used in production (eg. KOMP which is not actively developed anymore, StarPU which mainly focus on GPUs and optimizing the critical path, OmpSS which is not fully compatible with OpenMP but try to extend it, PaRSEC which is mainly designed for linear algebra applications).
QUESTION
A root-owned setuid bit daemon switches back to the real user and creates a mount namespace.
A user-owned executable with CAP_SYS_ADMIN
and CAP_SYS_CHROOT
bits set tries to enter that namespace and fails.
daemon.c
:
ANSWER
Answered 2022-Feb-08 at 15:38Try using:
QUESTION
I've seen that I can repeat a function with python every x seconds by using a event loop library in this post:
...ANSWER
Answered 2022-Jan-21 at 10:33If you think along the lines of a forever running program, you have to ping the system time using something like now = datetime.now()
. Now if you want 1 sec accuracy to catch that :00
window, that means you have to ping a lot more often.
Usually a better way is to schedule the script execution outside using Windows Task Scheduler or Crontab in Linux systems.
For example, this should run every XX:YY:00
:
QUESTION
I'm trying to learn about multithreaded algorithms so I've implemented a simple find max number function of an array. I've made a baseline program (findMax1.c) which loads from a file about 263 million int numbers into memory. Then I simply use a for loop to find the max number. Then I've made another program (findMax2.c) which uses 4 threads. I chose 4 threads because the CPU (intel i5 4460) I'm using has 4 cores and 1 thread per core. So my guess is that if I assign each core a chunk of the array to process it would be more efficient because that way I'll have fewer cache misses. Now, each thread finds the max number from each chunk, then I join all threads to finally find the max number from all those chunks. The baseline program findMax1.c takes about 660ms to complete the task, so my initial thought was that findMax2.c (which uses 4 threads) would take about 165ms (660ms / 4) to complete since now I have 4 threads running all in parallel to do the same task, but findMax2.c takes about 610ms. Only 50ms less than findMax1.c. What am I missing? is there something wrong with the implementation of the threaded program?
findMax1.c
...ANSWER
Answered 2021-Dec-06 at 15:51First of all, you're measuring your time wrong.
clock()
measures process CPU time, i.e., time used by all threads. The real elapsed time will be fraction of that. clock_gettime(CLOCK_MONOTONIC,...)
should yield better measurements.
Second, your core loops aren't at all comparable.
In the multithreaded program you're writing in each loop iteration to global variables that are very close to each other and that is horrible for cache contention.
You could space that global memory apart (make each array item a cache-aligned struct (_Alignas(64)
)) and that'll help the time, but a better and fairer approach would be to use local variables (which should go into registers), copying the approach of the first loop, and then write out the chunk result to memory at the end of the loop:
QUESTION
I've written a couple production BPF agents, but my approach is very iterative until I please the verifier and can move on. I've reached my limit again.
Here's a program that works if I have one fewer &&
condition -- and breaks otherwise. The confusing part is that the warning implies that 103 insns
is greater-than at most 4096 insns
. There's obviously something I'm misunderstanding about how this is all strung together.
My ultimate goal is to do logging based on a process' environment -- so alternative approaches are welcome. :)
Error:
...ANSWER
Answered 2021-Nov-29 at 09:48bpf: Argument list too long. Program too large (103 insns), at most 4096 insns
Looking at the error message, my guess would be that your program has 103 instructions and it's rejected because it's too complex. That is, the verifier gave up before analyzing all instructions on all paths.
On Linux 5.15 with a privileged user, the verifier gives up after reading 1 million instructions (the complexity limit). Since it has to analyze all paths through the program, a program with a small number of instructions can have a very high complexity. That's particularly the case when you have loops and many conditions, as is your case.
Why is the error message confusing? This error message is coming from libbpf.c:
QUESTION
ANSWER
Answered 2021-Oct-07 at 01:06Get the oldest sibling of the youngest child:
QUESTION
I am using apscheduler
for my Django project. I am trying to list all users every 10 seconds.
But when I try that there is an error:
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
scheduler.py
...ANSWER
Answered 2021-Sep-25 at 11:07Import the scheduler module only in the ready
function, otherwise you are importhing the serializer, and thus by extent the models before these are loaded:
QUESTION
I have pod A (it's actually the kube-scheduler pod) and pod B (a pod that has a REST API that will be invoked by pod A).
For this purpose, I created a ClusterIP service.
Now, when I exec into pod A to perform the API call to pod B, I get:
curl: (6) Could not resolve host: my-svc.default.svc.cluster.local
I tried to follow the debug instructions mentioned here:
...ANSWER
Answered 2021-Sep-23 at 12:27Error curl: (6) Could not resolve host
mainly occurs due to a wrong DNS set up or bad settings on the server. You can find an explanation of this problem.
If you want to apply a custom DNS configuration you can do so according to this documentation:
If a Pod's
dnsPolicy
is set todefault
, it inherits the name resolution configuration from the node that the Pod runs on. The Pod's DNS resolution should behave the same as the node. But see Known issues.If you don't want this, or if you want a different DNS config for pods, you can use the kubelet's
--resolv-conf
flag. Set this flag to "" to prevent Pods from inheriting DNS. Set it to a valid file path to specify a file other than/etc/resolv.conf
for DNS inheritance.
Another solution will be to create your own system image in which you already put the values you are interested in.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sched
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page