一个自托管运行器一次只能运行一个作业,当没有可用运行器空闲时,后续作业将排队等待,直到有可用运行器空闲。
我可以通过在具有多个 CPU 的同一台机器上运行多个自托管运行器来实现并行性吗?
在GitHub Actions - Getting Started - Usage Limits我发现:
您可以在您的帐户中运行的并发作业数取决于您的 GitHub 计划,如下表所示。如果超过,任何其他作业都会排队。自托管运行器没有并发限制。
但我不确定如何在多核机器的上下文中理解这一点。
continuous-integration github multiprocessing devops github-actions
什么是定义不需要任何构造函数参数的类的“Pythonic”方法?
class MyClass:
# class body
Run Code Online (Sandbox Code Playgroud)
或者我们需要一个显式的构造函数吗?IE
class MyClass:
def __init__:
pass
# class body
Run Code Online (Sandbox Code Playgroud) 我一直在尝试计算 Python 中 H2O 模块中梯度增强分类器的 SHAP 值。下面是该predict_contibutions方法的文档中的改编示例(改编自https://github.com/h2oai/h2o-3/blob/master/h2o-py/demos/predict_contributionsShap.ipynb)。
import h2o
import shap
from h2o.estimators.gbm import H2OGradientBoostingEstimator
from h2o import H2OFrame
# initialize H2O
h2o.init()
# load JS visualization code to notebook
shap.initjs()
# Import the prostate dataset
h2o_df = h2o.import_file("https://raw.github.com/h2oai/h2o/master/smalldata/logreg/prostate.csv")
# Split the data into Train/Test/Validation with Train having 70% and test and validation 15% each
train,test,valid = h2o_df.split_frame(ratios=[.7, .15])
# Convert the response column to a factor
h2o_df["CAPSULE"] = h2o_df["CAPSULE"].asfactor()
# Generate a GBM model using …Run Code Online (Sandbox Code Playgroud) 正如这里所讨论的,在 GitHub Actions 中有一种使用关键字引用job其他jobs 中的 s的好方法need,例如
name: Share data between jobs
on: [push]
jobs:
job_1:
name: Add 3 and 7
runs-on: ubuntu-latest
steps:
# Steps
job_2:
name: Multiply by 9
needs: job_1
# The rest of the job
Run Code Online (Sandbox Code Playgroud)
我在文档中找不到答案的问题是:有没有办法job在其他工作流中引用/共享s?(即单独的yml文件)。
我的项目由几个单独的工作流组成,每个工作流都需要执行相同的初始steps。我试图避免在不同的workflows 中复制粘贴相同的步骤。
continuous-integration github continuous-deployment devops github-actions