pipeline

how to use “if” statements inside pipeline

╄→尐↘猪︶ㄣ 提交于 2019-12-03 08:58:36
问题 I'm trying to use if inside a pipeline. I know that there is where (alias ? ) filter, but what if I want activate a filter only if a certain condition is satisfied? I mean, for example: get-something | ? {$_.someone -eq 'somespecific'} | format-table How to use if inside the pipeline to switch the filter on/off? Is it possible? Does it make sense? Thanks EDITED to clarify Without pipeline it would look like this: if($filter) { get-something | ? {$_.someone -eq 'somespecific'} } else { get

Create Jenkins Docker Image with pre configured jobs

谁说胖子不能爱 提交于 2019-12-03 07:04:33
I have created a bunch of Local deployment pipeline jobs, these jobs do things like remove an existing container, build a service locally, build a docker image, run the container - etc. These are not CI/CD jobs, just small pipelines for deploying locally during dev. What I want to do now is make this available to all our devs, so they can just simply spin up a local instance of jenkins that already contains the jobs. My docker file is reasonably straight forward... FROM jenkins:latest USER root RUN apt-get update RUN apt-get install -y sudo RUN echo "jenkins ALL=NOPASSWD: ALL" >> /etc/sudoers

R: combine several gsub() function in a pipe

孤人 提交于 2019-12-03 06:44:40
To clean some messy data I would like to start using pipes %>% , but I fail to get the R code working if gsub() is not at the beginning of the pipe, should occur late (Note: this question is not concerned with proper import, but with data cleaning). Simple example: df <- cbind.data.frame(A= c("2.187,78 ", "5.491,28 ", "7.000,32 "), B = c("A","B","C")) Column A contains characters (in this case numbers, but this also could be string) and need to be cleaned. The steps are df$D <- gsub("\\.","",df$A) df$D <- str_trim(df$D) df$D <- as.numeric(gsub(",", ".",df$D)) One easily could pipe this df$D <-

How to extract tar archive from stdin?

孤人 提交于 2019-12-03 06:30:18
问题 I have a large tar file I split . Is it possible to cat and untar the file using pipeline. Something like: cat largefile.tgz.aa largefile.tgz.ab | tar -xz instead of: cat largefile.tgz.aa largfile.tgz.ab > largefile.tgz tar -xzf largefile.tgz I have been looking around and I can't find the answer. I wanted to see if it was possible. 回答1: Use - as the input file: cat largefile.tgz.aa largefile.tgz.ab | tar zxf - Make sure you cat them in the same order they were split. If you're using zsh you

How to implement SMOTE in cross validation and GridSearchCV

左心房为你撑大大i 提交于 2019-12-03 03:18:39
I'm relatively new to Python. Can you help me improve my implementation of SMOTE to a proper pipeline? What I want is to apply the over and under sampling on the training set of every k-fold iteration so that the model is trained on a balanced data set and evaluated on the imbalanced left out piece. The problem is that when I do that I cannot use the familiar sklearn interface for evaluation and grid search. Is it possible to make something similar to model_selection.RandomizedSearchCV . My take on this: df = pd.read_csv("Imbalanced_data.csv") #Load the data set X = df.iloc[:,0:64] X = X

how to use xargs with sed in search pattern

十年热恋 提交于 2019-12-03 02:03:33
I need to use the output of a command as a search pattern in sed. I will make an example using echo, but assume that can be a more complicated command: echo "some pattern" | xargs sed -i 's/{}/replacement/g' file.txt That command doesn't work because "some pattern" has a whitespace, but I think that clearly illustrate my problem. How can I make that command work? Thanks in advance, Use command substitution instead, so your example would look like: sed -i "s/$(echo "some pattern")/replacement/g" file.txt The double quotes allow for the command substitution to work while preventing spaces from

What is a good tool for Build Pipelines?

佐手、 提交于 2019-12-03 00:11:21
I need a tool that will graphically represent our build pipeline. The below screenshots of ThoughtWorks Go and the Jenkins Pipeline plugin illustrate almost exactly what I want it to look like. The problem is that we already use Jenkins for our builds and deployments, along with a few other custom tools for orchestration type duties. We don't want a pipeline tool to do the builds or deployments itself, it just needs to invoke Jenkins! I tried out Go, and the first thing it asked for is where my source code is and how to build it. I couldn't get Go to work in a way where Jenkins does the builds

python pipe only stdin,out once, how to do twice or more time

删除回忆录丶 提交于 2019-12-02 22:17:03
问题 success python pipe stdin, out only one time this source main.py import subprocess from subprocess import PIPE, STDOUT player_pipe = subprocess.Popen(["source\call.py", 'arg1'], stdin=PIPE, stdout=PIPE, stderr=STDOUT, shell=True) player_pipe.stdin.write("Send Msg\n") get_stdout = player_pipe.stdout.readline() print("[Get Msg]" + get_stdout) player_pipe.kill() player_pipe.wait() call.py import sys getMsg = raw_input() print getMsg but I want twice or more time stdin, out so update source but

Invalid parameter for sklearn estimator pipeline

被刻印的时光 ゝ 提交于 2019-12-02 22:10:39
I am implementing an example from the O'Reilly book " Introduction to Machine Learning with Python ", using Python 2.7 and sklearn 0.16. The code I am using: pipe = make_pipeline(TfidfVectorizer(), LogisticRegression()) param_grid = {"logisticregression_C": [0.001, 0.01, 0.1, 1, 10, 100], "tfidfvectorizer_ngram_range": [(1,1), (1,2), (1,3)]} grid = GridSearchCV(pipe, param_grid, cv=5) grid.fit(X_train, y_train) print("Best cross-validation score: {:.2f}".format(grid.best_score_)) The error being returned boils down to: ValueError: Invalid parameter logisticregression_C for estimator Pipeline

Can a failed Airflow DAG Task Retry with changed parameter

折月煮酒 提交于 2019-12-02 20:46:57
问题 With Airflow, is it possible to restart an upstream task if a downstream task fails? This seems to be against the "Acyclic" part of the term DAG. I would think this is a common problem though. Background I'm looking into using Airflow to manage a data processing workflow that has been managed manually. There is a task that will fail if a parameter x is set too high, but increasing the parameter value gives better quality results. We have not found a way to calculate a safe but maximally high