fixed pyl issues and set max threads based on cpu cores w/ burnettk

This commit is contained in:
jasquat 2023-05-17 14:04:48 -04:00
parent 054cd4d3df
commit d2e2478e06
3 changed files with 12 additions and 12 deletions

View File

@ -75,14 +75,14 @@ if [[ -z "${SPIFFWORKFLOW_BACKEND_THREADS_PER_WORKER:-}" ]]; then
# I/O heavy, make it larger # I/O heavy, make it larger
threads_to_use_per_core=3 threads_to_use_per_core=3
# just making up a number here for num_cores_multiple_for_threads
# https://stackoverflow.com/a/55423170/6090676 # https://stackoverflow.com/a/55423170/6090676
# if we had access to python (i'm not sure i want to run another python script here), # if we had access to python (i'm not sure i want to run another python script here),
# we could do something like this (on linux) to get the number of cores available to this process and a better estimate of a # we could do something like this (on linux) to get the number of cores available to this process and a better estimate of a
# reasonable num_cores_multiple_for_threads # reasonable num_cores_multiple_for_threads
# if hasattr(os, 'sched_getaffinity') # if hasattr(os, 'sched_getaffinity')
# number_of_available_cores = os.sched_getaffinity(0) # number_of_available_cores = os.sched_getaffinity(0)
num_cores_multiple_for_threads=2 # BUT the python solution isn't even as portable as this one, which is mostly posix compliant and works on linux/mac/freebsd.
num_cores_multiple_for_threads=$(getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1)
SPIFFWORKFLOW_BACKEND_THREADS_PER_WORKER=$((threads_to_use_per_core * num_cores_multiple_for_threads)) SPIFFWORKFLOW_BACKEND_THREADS_PER_WORKER=$((threads_to_use_per_core * num_cores_multiple_for_threads))
export SPIFFWORKFLOW_BACKEND_THREADS_PER_WORKER export SPIFFWORKFLOW_BACKEND_THREADS_PER_WORKER

View File

@ -3,6 +3,7 @@ import { Content } from '@carbon/react';
import { BrowserRouter, Routes, Route } from 'react-router-dom'; import { BrowserRouter, Routes, Route } from 'react-router-dom';
import { defineAbility } from '@casl/ability'; import { defineAbility } from '@casl/ability';
import React from 'react';
import NavigationBar from './components/NavigationBar'; import NavigationBar from './components/NavigationBar';
import HomePageRoutes from './routes/HomePageRoutes'; import HomePageRoutes from './routes/HomePageRoutes';
@ -15,8 +16,7 @@ import { AbilityContext } from './contexts/Can';
import UserService from './services/UserService'; import UserService from './services/UserService';
import ErrorDisplay from './components/ErrorDisplay'; import ErrorDisplay from './components/ErrorDisplay';
import APIErrorProvider from './contexts/APIErrorContext'; import APIErrorProvider from './contexts/APIErrorContext';
import ScrollToTop from "./components/ScrollToTop"; import ScrollToTop from './components/ScrollToTop';
import React from "react";
export default function App() { export default function App() {
if (!UserService.isLoggedIn()) { if (!UserService.isLoggedIn()) {

View File

@ -1,12 +1,12 @@
import { useEffect } from "react"; import { useEffect } from 'react';
import { useLocation } from "react-router-dom"; import { useLocation } from 'react-router-dom';
export default function ScrollToTop() { export default function ScrollToTop() {
const { pathname } = useLocation(); const { pathname } = useLocation();
useEffect(() => { useEffect(() => {
window.scrollTo(0, 0); window.scrollTo(0, 0);
}, [pathname]); }, [pathname]);
return null; return null;
} }