问:
In YARN what is the difference between a managed and an unmanaged Application Manager
I'm experimenting with the Distributed Shell example in YARN 2.2 and am hoping that someone can clarify what the difference between a managed and and an un-managed application manager is?

For example the following lines appear in the client code

```<code>// unmanaged AM
appContext.setUnmanagedAM(true);
</code>```

but I am unable to find documentation explaining the difference this line makes to the execution behaviour.

Many thanks.

答:
Check the respective JIRA tickets: JIRA-420 and JIRA-419 (client side)

```<code>Currently, the RM itself manages the AM by allocating a container for it and negotiating the launch on the NodeManager and manages the AM lifecycle. Thereafter, the AM negotiates resources with the RM and launches tasks to do the real work.
It would be a useful improvement to enhance this model by allowing the AM to be launched independently by the client without requiring the RM. These AM's would be launched on a gateway machine that can talk to the cluster. This would open up new use cases such as the following
1) Easy debugging of AM, specially during initial development. Having the AM launched on an arbitrary cluster node makes it hard to looks at logs or attach a debugger to the AM. If it can be launched locally then these tasks would be easier.
2) Running AM's that need special privileges that may not be available on machines managed by the NodeManager
</code>```

Blog post with more implementation details on unmanaged AM: click-me

Example of how Impala manages its resources with the help of unmanaged applications: Llama

Body:
I'm experimenting with the Distributed Shell example in YARN 2.2 and am hoping that someone can clarify what the difference between a managed and and an un-managed application manager is?

For example the following lines appear in the client code

// unmanaged AM
appContext.setUnmanagedAM(true);

but I am unable to find documentation explaining the difference this line makes to the execution behaviour.

Many thanks.

Body:
Check the respective JIRA tickets: JIRA-420 and JIRA-419 (client side)

Currently, the RM itself manages the AM by allocating a container for it and negotiating the launch on the NodeManager and manages the AM lifecycle. Thereafter, the AM negotiates resources with the RM and launches tasks to do the real work.
It would be a useful improvement to enhance this model by allowing the AM to be launched independently by the client without requiring the RM. These AM's would be launched on a gateway machine that can talk to the cluster. This would open up new use cases such as the following
1) Easy debugging of AM, specially during initial development. Having the AM launched on an arbitrary cluster node makes it hard to looks at logs or attach a debugger to the AM. If it can be launched locally then these tasks would be easier.
2) Running AM's that need special privileges that may not be available on machines managed by the NodeManager

Blog post with more implementation details on unmanaged AM: click-me

Example of how Impala manages its resources with the help of unmanaged applications: Llama


来源: stackexchange

问:
How to get a zero matrix with only upper diagonal elements? (The elements of upper diagonal are known)
I have a given row matrix  and i want it to be elements of upper diagonal on my zero matrix

If i have a matrix a = [1,2,3] then i want my output as

```<code>[[0 1 0 0]
[0 0 2 0]
[0 0 0 3]
[0 0 0 0]]
</code>```

my original code is

```<code>import numpy as np
N=5
a0=2*np.ones((1,N))
a1=-1*np.ones((1,(N-1)))
A0=np.diag(a0,0)
A1=np.diag(a1,1)
A2=np.diag(a1,-1)
</code>```

The output of A1 is only [-1] when i require is the complete matrix with elements a1 on the upper diagonal

ContentLicense: CC BY-SA 4.0

Body:
I have a given row matrix  and i want it to be elements of upper diagonal on my zero matrix

If i have a matrix a = [1,2,3] then i want my output as

[[0 1 0 0]
[0 0 2 0]
[0 0 0 3]
[0 0 0 0]]

my original code is

import numpy as np
N=5
a0=2*np.ones((1,N))
a1=-1*np.ones((1,(N-1)))
A0=np.diag(a0,0)
A1=np.diag(a1,1)
A2=np.diag(a1,-1)

The output of A1 is only [-1] when i require is the complete matrix with elements a1 on the upper diagonal

Body:
You can use np.diag with an offset:

a=np.array([1,2,3])
np.diag(a, 1)

array([[0, 1, 0, 0],
       [0, 0, 2, 0],
       [0, 0, 0, 3],
       [0, 0, 0, 0]])


问:
Getting Wrong Value while trying to find the Volatility
```<code>covariance_matrix = clean_returns.cov()
temp_list = []

for row in temp.iterrows():
    index, data = row
    temp_list = data.tolist()
    npa = np.asarray(temp_list)
    npa_trans = npa.transpose()
    Portfolio_Returns['Volatility'] = np.sqrt(
        np.dot(npa_trans, np.dot(covariance_matrix, npa)))
</code>```

I expected to get different Volatility Values however the dataframe is showing the same value which is 0.022906

答:
the code saves the last value of the volatility calculated in the whole "Volatility" column instead of saving each volatility value in each row </p>

```<code>       Portfolio_Returns['Volatility'] = np.sqrt(
            np.dot(npa_trans, np.dot(covariance_matrix, npa))
</code>```

Body:
covariance_matrix = clean_returns.cov()
temp_list = []

for row in temp.iterrows():
    index, data = row
    temp_list = data.tolist()
    npa = np.asarray(temp_list)
    npa_trans = npa.transpose()
    Portfolio_Returns['Volatility'] = np.sqrt(
        np.dot(npa_trans, np.dot(covariance_matrix, npa)))

I expected to get different Volatility Values however the dataframe is showing the same value which is 0.022906

Body:
the code saves the last value of the volatility calculated in the whole "Volatility" column instead of saving each volatility value in each row

       Portfolio_Returns['Volatility'] = np.sqrt(
            np.dot(npa_trans, np.dot(covariance_matrix, npa))


问:
filter() with includes() to get partial matches
I have already tried the answer provided on this question Using filter() in combination with includes() to get partial matches

But it does not really solve the issue in my case since this answer only works if the text is smaller than the value in array.

I am using this code right now, which in the example I provided works and finds 'alex':

let search = (list, text) =>
    list.filter(i => i.toLowerCase().includes(text.toLowerCase()));

var items = ['john', 'bob', 'alex'];

var result = search(items, 'al');
console.log(result);```

But, if I run result = search(items, 'alexander') it will not work, for my use-case I need to be able to find items this way as well.

To give context as to why I need this, I have users with an array of permission roles like ['admin.all', 'calendar.self', 'calendar.other'] and my menu items also have a parameter like calendar specifying which scopes they belong too (partially) and I use these 2 to determine if the user should see the menu item.

I want to be able to run result = search(menuRoles, 'calendar.self') and have the role calendar returned to me which then would mean I can show it.

答:
Check if your search value also includes the current string

let search = (list, text) =>
    list.filter(i => i.toLowerCase().includes(text.toLowerCase()) || text.toLowerCase().includes(i.toLowerCase()));

var items = ['john', 'bob', 'alex'];

var result = search(items, 'alexander');
console.log(result);```

Body:
I have already tried the answer provided on this question Using filter() in combination with includes() to get partial matches

But it does not really solve the issue in my case since this answer only works if the text is smaller than the value in array.

I am using this code right now, which in the example I provided works and finds 'alex':

let search = (list, text) =>
    list.filter(i => i.toLowerCase().includes(text.toLowerCase()));

var items = ['john', 'bob', 'alex'];

var result = search(items, 'al');
console.log(result);

But, if I run result = search(items, 'alexander') it will not work, for my use-case I need to be able to find items this way as well.

To give context as to why I need this, I have users with an array of permission roles like ['admin.all', 'calendar.self', 'calendar.other'] and my menu items also have a parameter like calendar specifying which scopes they belong too (partially) and I use these 2 to determine if the user should see the menu item.

I want to be able to run result = search(menuRoles, 'calendar.self') and have the role calendar returned to me which then would mean I can show it.


问:
Variable line limits with ggplot()
I am plotting a number of time series on a single pair of axes. The series cover a range of timeframes - e.g. some cover a year, some only a few months. I would like the resulting charts to plot one line per series, with each line visible only for the timeframe that the series covers.

The data behind the chart is a format of a dataframe (meltdf2) with 4 columns - Month, user, score and risk.

A simplified version would be:

```<code>Month   user   score   risk
jan-18  A      1       high
feb-18  A      1       high
mar-18  A      2       mid
apr-18  A      1       high
feb-18  B      1       high
mar-18  B      2       mid
apr-18  B      3       low
mar-18  C      3       low
apr-18  C      3       low
</code>```

Currently, the chart displays three lines, one for each user, each line covering the full with of the chart.
Ideally, I would have a chart with line A would span the full width of the chart, while lines B and C would only span part of the chart.

I have tried including NA values for the months not covered by B and C but their lines still span the full chart. Failing the NA value route, I have tried to manually set multiple colours on a single line but this doesn't seem to work.

The current code I am using is as follows:

```<code>#create colour palette based on discrete risk levels - used to specify manual colour scale in plot.
pal <- c("High"="red2","Mid"="gold","Low" = "limegreen","NA"= "NA")

#create plot with line and points.
#colour of points based on colour column of meltdf2
ggplot(data = meltdf2, aes(x = Month, y = user, group = user)) +
  geom_line(linetype = "dashed", colour = "grey") +
  geom_point(aes(colour = meltdf2$risk, size = 3)) +
  scale_colour_manual(values = pal, limits = names(pal)) +
  scale_x_date(date_breaks = "1 month" , date_labels = "%b-%y") +
  theme(axis.title.y=element_blank(), axis.text.y=element_blank(), axis.ticks.y=element_blank(),
        axis.line.x = element_line(colour = "darkgrey"),
        panel.background = element_rect(fill = "white"),
        panel.grid.major = element_blank(), panel.grid.minor = element_blank())
</code>```

This code produces the following chart:

Ideally, the section of each of the dashed grey lines prior to the first datapoint for each series would not be displayed.

答:
This issue was resolved by modifying the dataframe (meltdf2) behind the chart. Using na.omit(meltdf2) removed rows where no data existed for each series and prevented the line from plotting.
End result below:

Title: Variable line limits with ggplot()

Body:
I am plotting a number of time series on a single pair of axes. The series cover a range of timeframes - e.g. some cover a year, some only a few months. I would like the resulting charts to plot one line per series, with each line visible only for the timeframe that the series covers.

The data behind the chart is a format of a dataframe (meltdf2) with 4 columns - Month, user, score and risk.

A simplified version would be:

Month   user   score   risk
jan-18  A      1       high
feb-18  A      1       high
mar-18  A      2       mid
apr-18  A      1       high
feb-18  B      1       high
mar-18  B      2       mid
apr-18  B      3       low
mar-18  C      3       low
apr-18  C      3       low

Currently, the chart displays three lines, one for each user, each line covering the full with of the chart.
Ideally, I would have a chart with line A would span the full width of the chart, while lines B and C would only span part of the chart.

I have tried including NA values for the months not covered by B and C but their lines still span the full chart. Failing the NA value route, I have tried to manually set multiple colours on a single line but this doesn't seem to work.

The current code I am using is as follows:

#create colour palette based on discrete risk levels - used to specify manual colour scale in plot.
pal <- c("High"="red2","Mid"="gold","Low" = "limegreen","NA"= "NA")

#create plot with line and points.
#colour of points based on colour column of meltdf2
ggplot(data = meltdf2, aes(x = Month, y = user, group = user)) +
  geom_line(linetype = "dashed", colour = "grey") +
  geom_point(aes(colour = meltdf2$risk, size = 3)) +
  scale_colour_manual(values = pal, limits = names(pal)) +
  scale_x_date(date_breaks = "1 month" , date_labels = "%b-%y") +
  theme(axis.title.y=element_blank(), axis.text.y=element_blank(), axis.ticks.y=element_blank(),
        axis.line.x = element_line(colour = "darkgrey"),
        panel.background = element_rect(fill = "white"),
        panel.grid.major = element_blank(), panel.grid.minor = element_blank())

This code produces the following chart:

Ideally, the section of each of the dashed grey lines prior to the first datapoint for each series would not be displayed.


问:
How to make stdin file descriptor ready when pressing a key?
I have a custom _kbhit() function used for non-blocking character input.
_kbhit() function uses select() to check if stdin is ready to read.
But finally I have stdin ready if only I pressed RETURN.
How to make it work when I press any key?

```<code>void set_conio_terminal_mode()
{
    struct termios new_termios;

    /* take two copies - one for now, one for later */
    tcgetattr(0, &new_termios);

    /* register cleanup handler, and set the new terminal mode */
    atexit(reset_terminal_mode);
    cfmakeraw(&new_termios);
    tcsetattr(0, TCSANOW, &new_termios);
}

int _kbhit()
{
    struct timeval tv = { 0L, 0L };
    fd_set fds;
    FD_ZERO(&fds);
    FD_SET(0, &fds);
    return select(1, &fds, NULL, NULL, &tv);
}

static char _getch(void) {
    int r;
    unsigned char c;
    if ((r = read(0, &c, sizeof(c))) < 0) {
        return r;
    } else {
        return c;
    }
}

int main( int argc, char *argv[] )
{
    set_conio_terminal_mode();
    while (1) {
        if (_kbhit()) {
            inputbuffer[inputlen] = _getch();
            if (inputbuffer[inputlen] >= 0x20 && inputbuffer[inputlen] < 0x7F) {
                putchar(inputbuffer[inputlen]);
                inputlen++;
            }
        }
    }
}
</code>```

I expected that this code will output echo, but it outputs entire string just after I press RETURN.

答:
I think the problem is that - despite your initialization of the terminal attributes using cfmakeraw() - stdout is still in line-buffered mode.

Try setting standard output to unbuffered mode.

```<code>setbuf(stdout, NULL);
</code>```

which is equivalent to

```<code>setvbuf(stdout, NULL, _IONBF, 0);
</code>```

This avoids the need to call fflush(stdout); after every putchar(inputbuffer[inputlen]);.

There may be a way of accomplishing this using tcsetattr() instead of setvbuf(), buf I am not familiar with it.

Body:
I have a custom _kbhit() function used for non-blocking character input.
_kbhit() function uses select() to check if stdin is ready to read.
But finally I have stdin ready if only I pressed RETURN.
How to make it work when I press any key?

void set_conio_terminal_mode()
{
    struct termios new_termios;

    /* take two copies - one for now, one for later */
    tcgetattr(0, &new_termios);

    /* register cleanup handler, and set the new terminal mode */
    atexit(reset_terminal_mode);
    cfmakeraw(&new_termios);
    tcsetattr(0, TCSANOW, &new_termios);
}

int _kbhit()
{
    struct timeval tv = { 0L, 0L };
    fd_set fds;
    FD_ZERO(&fds);
    FD_SET(0, &fds);
    return select(1, &fds, NULL, NULL, &tv);
}

static char _getch(void) {
    int r;
    unsigned char c;
    if ((r = read(0, &c, sizeof(c))) < 0) {
        return r;
    } else {
        return c;
    }
}

int main( int argc, char *argv[] )
{
    set_conio_terminal_mode();
    while (1) {
        if (_kbhit()) {
            inputbuffer[inputlen] = _getch();
            if (inputbuffer[inputlen] >= 0x20 && inputbuffer[inputlen] < 0x7F) {
                putchar(inputbuffer[inputlen]);
                inputlen++;
            }
        }
    }
}

I expected that this code will output echo, but it outputs entire string just after I press RETURN.

Body:
I think the problem is that - despite your initialization of the terminal attributes using cfmakeraw() - stdout is still in line-buffered mode.

Try setting standard output to unbuffered mode.

setbuf(stdout, NULL);

which is equivalent to

setvbuf(stdout, NULL, _IONBF, 0);

This avoids the need to call fflush(stdout); after every putchar(inputbuffer[inputlen]);.

There may be a way of accomplishing this using tcsetattr() instead of setvbuf(), buf I am not familiar with it.


问:
How can I convert a string to boolean in JavaScript?
Can I convert a string representing a boolean value (e.g., 'true', 'false') into a intrinsic type in JavaScript?

I have a hidden form in HTML that is updated based upon a user's selection within a list. This form contains some fields which represent boolean values and are dynamically populated with an intrinsic boolean value. However, once this value is placed into the hidden input field it becomes a string.

The only way I could find to determine the field's boolean value, once it was converted into a string, was to depend upon the literal value of its string representation.

```<code>var myValue = document.myForm.IS_TRUE.value;
var isTrueSet = myValue == 'true';
</code>```

Is there a better way to accomplish this?

答:
The simplest way which I always use:</p>

```<code>let value = 'true';
let output = value === 'true';
</code>```

OwnerDisplayName: Kevin

ContentLicense: CC BY-SA 2.5

Body:
Can I convert a string representing a boolean value (e.g., 'true', 'false') into a intrinsic type in JavaScript?

I have a hidden form in HTML that is updated based upon a user's selection within a list. This form contains some fields which represent boolean values and are dynamically populated with an intrinsic boolean value. However, once this value is placed into the hidden input field it becomes a string.

The only way I could find to determine the field's boolean value, once it was converted into a string, was to depend upon the literal value of its string representation.

var myValue = document.myForm.IS_TRUE.value;
var isTrueSet = myValue == 'true';

Is there a better way to accomplish this?

Body:
The simplest way which I always use:

let value = 'true';
let output = value === 'true';


问:
Gitlab CI jobs fail/pass randomly
I have some gitlab-ci.yml files for some projects that I want to deploy. After banging my head against the wall for several hours, I've realized that they pass/fail randomly. Of course, nothing changes, it's just a matter of pressing on the "Retry" button and sometimes the job will pass and other times it will fail.

This is a .gitlab-ci.yml that I'm working with:

```<code>image: docker:latest

services:
  - docker:dind

before_script:
  - echo "Runnig before_script"
  - apk add --no-cache py-pip python-dev libffi-dev openssl-dev gcc libc-dev make
  - pip install docker-compose

stages:
  - test
  - build
  - deploy

test:
  stage: test
  script:
    - echo "Testing the app"
    - docker-compose run app sh -c "python /app/manage.py test && flake8"

build:
  stage: build
  only:
    - develop
    - production
    - feature/deploy-debug-gitlab

  script:
    - echo "Building the app"
    - docker-compose build

deploy:
  stage: deploy
  only:
    - master
    - feature/deploy
  script:
    - echo "Deploying the app"
    - docker-compose up -d
  environment: production
  when: manual

</code>```

Am I doing something wrong there? It seems quite straight forward to me.

When the job fails, I always get the error: apk command not found. Like here:

```<code>Running with gitlab-runner 11.11.1 (5a147c92)
  on My Runner Jd5HNvxy
Using Shell executor...
Running on ubuntu-512mb-lon1-01...
Reinitialized existing Git repository in /home/gitlab-runner/builds/Jd5HNvxy/0/<my.name>/<my.app>/.git/
Fetching changes...
Checking out 3f388ce6 as feature/deploy...
Skipping Git submodules setup
$ echo "Runnig before_script"
Runnig before_script
$ apk add --no-cache py-pip python-dev libffi-dev openssl-dev gcc libc-dev make
bash: line 88: apk: command not found
ERROR: Job failed: exit status 1
</code>```

When the job passes, I get this:

```<code>Running with gitlab-runner 11.11.1 (5a147c92)
  on docker-auto-scale fa6cab46
Using Docker executor with image docker:latest ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
Using docker image sha256:bed64de70fa1f4d0b5a498791647c45d954cb0306ec2852dbcfb956f4ff3b0d6 for docker:dind ...
Waiting for services to be up and running...
Pulling docker image docker:latest ...
Using docker image sha256:af42f41a7d73a4a181843011f62cbdefa6d0f546bc7b50f71163750e0475a928 for docker:latest ...
Running on runner-fa6cab46-project-12561543-concurrent-0 via runner-fa6cab46-srm-1559293461-381b8d99...
Initialized empty Git repository in /builds/<my.name>/<my.app>/.git/
Fetching changes...
Created fresh repository.
From https://gitlab.com/<my.name>/<my.app>
 * [new branch]      develop        -> origin/develop
 * [new branch]      feature/deploy -> origin/feature/deploy
 * [new branch]      master         -> origin/master
Checking out 3f388ce6 as feature/deploy...

Skipping Git submodules setup
$ echo "Runnig before_script"
Runnig before_script
$ apk add --no-cache py-pip python-dev libffi-dev openssl-dev gcc libc-dev make
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/30) Installing binutils (2.31.1-r2)
(2/30) Installing gmp (6.1.2-r1)
(3/30) Installing isl (0.18-r0)
...
...
...
</code>```

答:
This happens because you have different runners, „My Runner Jd5HNvxy“ and „docker-auto-scale fa6cab46“. Your job is being executed by whichever runner is faster to grab the job.

In your failing case, your job runs on a runner marked as „shell executor“, running on an ubuntu system - visible in the logs. Ubuntu does not ship with the apk command, therefore the job fails.

Your other runner, however, uses the „docker“ executor, therefore pulling the docker image and running the job without issues.

Possible solutions:

Remove/pause the shell runner.

Make your runners „specific“ runners and assign them to the projects manually.

Add tags to your runners, e.g. „shell“ and „docker“. Then, in the CI config, declare to use a properly tagged runner. See the official docs for more info: https://docs.gitlab.com/ce/ci/yaml/README.html#tags

Title: Gitlab CI jobs fail/pass randomly

Body:
I have some gitlab-ci.yml files for some projects that I want to deploy. After banging my head against the wall for several hours, I've realized that they pass/fail randomly. Of course, nothing changes, it's just a matter of pressing on the "Retry" button and sometimes the job will pass and other times it will fail.

This is a .gitlab-ci.yml that I'm working with:

image: docker:latest

services:
  - docker:dind

before_script:
  - echo "Runnig before_script"
  - apk add --no-cache py-pip python-dev libffi-dev openssl-dev gcc libc-dev make
  - pip install docker-compose

stages:
  - test
  - build
  - deploy

test:
  stage: test
  script:
    - echo "Testing the app"
    - docker-compose run app sh -c "python /app/manage.py test && flake8"

build:
  stage: build
  only:
    - develop
    - production
    - feature/deploy-debug-gitlab

  script:
    - echo "Building the app"
    - docker-compose build

deploy:
  stage: deploy
  only:
    - master
    - feature/deploy
  script:
    - echo "Deploying the app"
    - docker-compose up -d
  environment: production
  when: manual

Am I doing something wrong there? It seems quite straight forward to me.

When the job fails, I always get the error: apk command not found. Like here:

Running with gitlab-runner 11.11.1 (5a147c92)
  on My Runner Jd5HNvxy
Using Shell executor...
Running on ubuntu-512mb-lon1-01...
Reinitialized existing Git repository in /home/gitlab-runner/builds/Jd5HNvxy/0/<my.name>/<my.app>/.git/
Fetching changes...
Checking out 3f388ce6 as feature/deploy...
Skipping Git submodules setup
$ echo "Runnig before_script"
Runnig before_script
$ apk add --no-cache py-pip python-dev libffi-dev openssl-dev gcc libc-dev make
bash: line 88: apk: command not found
ERROR: Job failed: exit status 1

When the job passes, I get this:

Running with gitlab-runner 11.11.1 (5a147c92)
  on docker-auto-scale fa6cab46
Using Docker executor with image docker:latest ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
Using docker image sha256:bed64de70fa1f4d0b5a498791647c45d954cb0306ec2852dbcfb956f4ff3b0d6 for docker:dind ...
Waiting for services to be up and running...
Pulling docker image docker:latest ...
Using docker image sha256:af42f41a7d73a4a181843011f62cbdefa6d0f546bc7b50f71163750e0475a928 for docker:latest ...
Running on runner-fa6cab46-project-12561543-concurrent-0 via runner-fa6cab46-srm-1559293461-381b8d99...
Initialized empty Git repository in /builds/<my.name>/<my.app>/.git/
Fetching changes...
Created fresh repository.
From https://gitlab.com/<my.name>/<my.app>
 * [new branch]      develop        -> origin/develop
 * [new branch]      feature/deploy -> origin/feature/deploy
 * [new branch]      master         -> origin/master
Checking out 3f388ce6 as feature/deploy...

Skipping Git submodules setup
$ echo "Runnig before_script"
Runnig before_script
$ apk add --no-cache py-pip python-dev libffi-dev openssl-dev gcc libc-dev make
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/30) Installing binutils (2.31.1-r2)
(2/30) Installing gmp (6.1.2-r1)
(3/30) Installing isl (0.18-r0)
...
...
...


问:
How to add wx.Treectrl items to another wx. treectrl
I have two Treectrl boxes and able to see the text files inside a folder in treectrl1. Need to select and  Add items[text files] from one TreeCtrl to another Treectrl box on click of a Butoon[Add]. Please help me with the code as i am new to Wx python. Thanks in advance.

```<code>def onclick(self, event):
     item = self.testtree.GetSelections()
     print self.testtree.GetPyData(item)
</code>```

Using above line of code was trying to access the selected item to move to the another treectrl . But was unable to retrieve item, instead it was printing the id of the selected item

答:
Without being able to see your code, I'll have to guess.

```<code>item = self.testtree.GetSelections()
</code>```

returns a list of currently selected items not a single instance.

Note: GetSelections can only be used if the style of the TreeCtrl is wx.TR_MULTIPLE

```<code>item = self.testtree.GetSelection()
</code>```

on the other hand does return a single item.

I suspect that you need something like:

```<code>items = self.tree.GetSelections()
for item in items:
    print(self.tree.GetItemText(item))
</code>```

Body:
I have two Treectrl boxes and able to see the text files inside a folder in treectrl1. Need to select and  Add items[text files] from one TreeCtrl to another Treectrl box on click of a Butoon[Add]. Please help me with the code as i am new to Wx python. Thanks in advance.

def onclick(self, event):
     item = self.testtree.GetSelections()
     print self.testtree.GetPyData(item)

Using above line of code was trying to access the selected item to move to the another treectrl . But was unable to retrieve item, instead it was printing the id of the selected item

Body:
Without being able to see your code, I'll have to guess.

item = self.testtree.GetSelections()

returns a list of currently selected items not a single instance.

Note: GetSelections can only be used if the style of the TreeCtrl is wx.TR_MULTIPLE

item = self.testtree.GetSelection()

on the other hand does return a single item.

I suspect that you need something like:

items = self.tree.GetSelections()
for item in items:
    print(self.tree.GetItemText(item))


问:
Is SQL Injection possible in the below query
So I'm reviewing some code and Fortify marked the following query as SQL Injectible</p>

```<code>"select"+seqName+".NEXTVAL from DUAL;"
</code>```

答: To avoid the SQL injection, you'd need to assert the value of the string before concatenating it into the statement, which you can do using one of the dbms_assert subprograms, e.g. DBMS_ASSERT.SQL_OBJECT_NAME

Body:
So I'm reviewing some code and Fortify marked the following query as SQL Injectible

"select"+seqName+".NEXTVAL from DUAL;"


问:
How to update a RoR model's associations without updating the corresponding model's attributes
I have the following models (with corresponding database tables) in my Rails 3 application:

```<code>class User < ActiveRecord::Base
  has_many :service_users
  has_many :services, :through => :service_users

  attr_accessor :password

  attr_accessible :password, :password_confirmation, :service_ids

  validates :password, :presence => true,
                       :confirmation => true,
                       :length => { :within => 6..40 }
  ...
end

class Service < ActiveRecord::Base
  has_many :service_users
  has_many :users, :through => :service_users
  ...
end

class ServiceUser < ActiveRecord::Base
  belongs_to :service
  belongs_to :user
end

#User Controller:

class UsersController < ApplicationController
  ...
  def update
    @user = User.find(params[:id])
    if @user.update_attributes(params[:user])
      flash[:success] = "Profile updated."
      redirect_to @user
    else
      @title = "Edit user"
      render 'edit'
    end
  end
  ...
end
</code>```

I want to be able to update a User model's associated services without having to specify the password and password confirmation attributes. How can I do this?

答:
This could help:

http://railscasts.com/episodes/41-conditional-validations

ContentLicense: CC BY-SA 3.0

Body:
I have the following models (with corresponding database tables) in my Rails 3 application:

class User < ActiveRecord::Base
  has_many :service_users
  has_many :services, :through => :service_users

  attr_accessor :password

  attr_accessible :password, :password_confirmation, :service_ids

  validates :password, :presence => true,
                       :confirmation => true,
                       :length => { :within => 6..40 }
  ...
end

class Service < ActiveRecord::Base
  has_many :service_users
  has_many :users, :through => :service_users
  ...
end

class ServiceUser < ActiveRecord::Base
  belongs_to :service
  belongs_to :user
end

#User Controller:

class UsersController < ApplicationController
  ...
  def update
    @user = User.find(params[:id])
    if @user.update_attributes(params[:user])
      flash[:success] = "Profile updated."
      redirect_to @user
    else
      @title = "Edit user"
      render 'edit'
    end
  end
  ...
end

I want to be able to update a User model's associated services without having to specify the password and password confirmation attributes. How can I do this?


问:
How to deal with asynchronous methods and IDisposable in C#?
I have some integration tests using xUnit that need to tear down some resources created during the test. To do that, I have implemented IDisposable in the class containing the tests.

The problem is I need to delete resources created during the test using a client that has only an asynchronous interface. But, the Dispose method is synchronous.

I could use .Result or .Wait() to wait for the completion of the asynchronous call, but that may create deadlocks (the issue is well-documented here).

Given I cannot use .Result or .Wait(), what is the proper (and safe) way to call an asynchronous method in a Dispose method?

UPDATE: adding a (simplified) example to show the problem.

```<code>[Collection("IntegrationTests")]
public class SomeIntegrationTests : IDisposable {
    private readonly IClient _client; // SDK client for external API

    public SomeIntegrationTests() {
        // initialize client
    }

    [Fact]
    public async Task Test1() {
        await _client
            .ExecuteAsync(/* a request that creates resources */);

        // some assertions
    }

    public void Dispose() {
        _client
            .ExecuteAsync(/* a request to delete previously created resources */)
            .Wait(); // this may create a deadlock
    }
}
</code>```

答:
A test class performs several tests that relate to each other. A test class usually tests a class, or a group of classes that closely work together. Sometimes a test class tests only one function.

Usually the tests should be designed such that they don't depend on other tests: Test A should succeed without having to run Test B, and the other way round: Tests may not assume anything about other tests.

Usually a test creates some precondition, calls the function being tested and checks whether the postcondition is met. Therefore every test usually creates its own environment.

If a bunch of tests needs a similar environment, to save test-time, it is quite common to create the environment once for all these tests, run the tests, and dispose the environment. This is what you do in your test class.

However, if in one of your tests you create a task to call an async function, you should wait inside that test for the result of that task. If you don't, you can't test whether the async function does what it is meant to do, namely: "Create a Task that, when awaited for, returns ...".

```<code>void TestA()
{
    Task taskA = null;
    try
    {
        // start a task without awaiting
        taskA = DoSomethingAsync();
        // perform your test
        ...
        // wait until taskA completes
        taskA.Wait();
        // check the result of taskA
        ...
     }
     catch (Exception exc)
     {
         ...
     }
     finally
     {
         // make sure that even if exception TaskA completes
         taskA.Wait();
     }
 }
</code>```

Conclusion: every Test method that creates a task should await for this class to complete before finishing

In rare occasions you don't to wait for the Task to complete before your test finishes. Maybe to see what happens if you don't await for the task. I still think that is a strange idea, because this might influence the other tests, but hey, it's your test class.

This means, that your Dispose does have to make sure that all started tasks that were not finished when the test method ended are awaited for.

```<code>List<Task> nonAwaitedTasks = new List<Task>();

var TestA()
{
    // start a Task, for some reason you don't want to await for it:
    Task taskA = DoSomethingAsync(...);
    // perform your test

    // finish without awaiting for taskA. Make sure it will be awaited before the
    // class is disposed:
    nonAwaitedTasks.Add(taskA);
}

public void Dispose()
{
    Dispose(true);
}
protected void Dispose(bool disposing)
{
    if (disposing)
    {
        // wait for all tasks to complete
        Task.WaitAll(this.nonAwaitedTasks);
    }
}
}
</code>```

Body:
I have some integration tests using xUnit that need to tear down some resources created during the test. To do that, I have implemented IDisposable in the class containing the tests.

The problem is I need to delete resources created during the test using a client that has only an asynchronous interface. But, the Dispose method is synchronous.

I could use .Result or .Wait() to wait for the completion of the asynchronous call, but that may create deadlocks (the issue is well-documented here).

Given I cannot use .Result or .Wait(), what is the proper (and safe) way to call an asynchronous method in a Dispose method?

UPDATE: adding a (simplified) example to show the problem.

[Collection("IntegrationTests")]
public class SomeIntegrationTests : IDisposable {
    private readonly IClient _client; // SDK client for external API

    public SomeIntegrationTests() {
        // initialize client
    }

    [Fact]
    public async Task Test1() {
        await _client
            .ExecuteAsync(/* a request that creates resources */);

        // some assertions
    }

    public void Dispose() {
        _client
            .ExecuteAsync(/* a request to delete previously created resources */)
            .Wait(); // this may create a deadlock
    }
}

Body:
A test class performs several tests that relate to each other. A test class usually tests a class, or a group of classes that closely work together. Sometimes a test class tests only one function.

Usually the tests should be designed such that they don't depend on other tests: Test A should succeed without having to run Test B, and the other way round: Tests may not assume anything about other tests.

Usually a test creates some precondition, calls the function being tested and checks whether the postcondition is met. Therefore every test usually creates its own environment.

If a bunch of tests needs a similar environment, to save test-time, it is quite common to create the environment once for all these tests, run the tests, and dispose the environment. This is what you do in your test class.

However, if in one of your tests you create a task to call an async function, you should wait inside that test for the result of that task. If you don't, you can't test whether the async function does what it is meant to do, namely: "Create a Task that, when awaited for, returns ...".

void TestA()
{
    Task taskA = null;
    try
    {
        // start a task without awaiting
        taskA = DoSomethingAsync();
        // perform your test
        ...
        // wait until taskA completes
        taskA.Wait();
        // check the result of taskA
        ...
     }
     catch (Exception exc)
     {
         ...
     }
     finally
     {
         // make sure that even if exception TaskA completes
         taskA.Wait();
     }
 }

Conclusion: every Test method that creates a task should await for this class to complete before finishing

In rare occasions you don't to wait for the Task to complete before your test finishes. Maybe to see what happens if you don't await for the task. I still think that is a strange idea, because this might influence the other tests, but hey, it's your test class.

This means, that your Dispose does have to make sure that all started tasks that were not finished when the test method ended are awaited for.

List<Task> nonAwaitedTasks = new List<Task>();

var TestA()
{
    // start a Task, for some reason you don't want to await for it:
    Task taskA = DoSomethingAsync(...);
    // perform your test

    // finish without awaiting for taskA. Make sure it will be awaited before the
    // class is disposed:
    nonAwaitedTasks.Add(taskA);
}

public void Dispose()
{
    Dispose(true);
}
protected void Dispose(bool disposing)
{
    if (disposing)
    {
        // wait for all tasks to complete
        Task.WaitAll(this.nonAwaitedTasks);
    }
}
}


问:
Trying to access function arguments from inner function
I'm using three.js and a script similar to OrbitControls as my controller. In my main.js file I have a THREE.Group() that is being passed to the controller as an argument. From there, I'm attempting to rotate the entire group.

Problem 1: once the group is passed to the controller, I can no longer access its properties without making a copy

Problem 2: a copy does not contain the entire THREE.Group(), rather only the first child

I've been working on this for hours now and I've tried about 50 different things including anything relevant on stackoverflow. I'm completely out of ideas on how to combat this problem.

main.js

```<code>let container;
let camera;
let controls;
let game;
let renderer;
let scene;

function init() {
    container = document.querySelector('#scene-container');
    scene = new THREE.Scene();

    const fov = 35;
    const aspect = container.clientWidth / container.clientHeight;
    const near = 0.1;
    const far = 100;
    camera = new THREE.PerspectiveCamera(fov, aspect, near, far);

  //***** This is the important line ******
    controls = new THREE.ObjectControls(camera, container, game);

    game = new THREE.Group();
    scene.add(game);

    const geometry = new THREE.BoxGeometry();
    const material = new THREE.MeshBasicMaterial();

    var mesh1 = new THREE.Mesh(geometry, material);
    game.add(mesh1);
    var mesh2 = new THREE.Mesh(geometry, material);
    mesh2.position.set(0,1,0);
    game.add(mesh2);

    renderer = new THREE.WebGLRenderer();
    renderer.setSize(container.clientWidth, container.clientHeight);
    renderer.setPixelRatio(window.devicePixelRatio);
    container.appendChild(renderer.domElement);

    renderer.setAnimationLoop(() => {
        renderer.render(scene, camera);
    });
}

init();
</code>```

ObjectControls.js

```<code>THREE.ObjectControls = function (camera, domElement, objectToMove) {
    mesh = objectToMove;
    domElement.addEventListener('mousemove', mouseMove, false);

    function mouseMove(e) {
        //** objectToMove is undefined :( **
        mesh.rotation.y += 3;
    }
};
</code>```

Expected result is that the entire THREE.Group() game will be rotated, but the result that I get is that only the first child of game is rotated, in this case mesh1.

答:
```<code>controls = new THREE.ObjectControls(camera, container, game);
game = new THREE.Group();
</code>```

There is an error in your code since you pass the undefined variable game to the ctor of ObjectControls. If you assign a new object to game one line later, ObjectControls does not have a reference to this variable.

The idea is to assign the group object to game first and then create ObjectControls. You essentially switch both lines.

three.js R105

Body:
I'm using three.js and a script similar to OrbitControls as my controller. In my main.js file I have a THREE.Group() that is being passed to the controller as an argument. From there, I'm attempting to rotate the entire group.

Problem 1: once the group is passed to the controller, I can no longer access its properties without making a copy

Problem 2: a copy does not contain the entire THREE.Group(), rather only the first child

I've been working on this for hours now and I've tried about 50 different things including anything relevant on stackoverflow. I'm completely out of ideas on how to combat this problem.

main.js

let container;
let camera;
let controls;
let game;
let renderer;
let scene;

function init() {
    container = document.querySelector('#scene-container');
    scene = new THREE.Scene();

    const fov = 35;
    const aspect = container.clientWidth / container.clientHeight;
    const near = 0.1;
    const far = 100;
    camera = new THREE.PerspectiveCamera(fov, aspect, near, far);

  //***** This is the important line ******
    controls = new THREE.ObjectControls(camera, container, game);

    game = new THREE.Group();
    scene.add(game);

    const geometry = new THREE.BoxGeometry();
    const material = new THREE.MeshBasicMaterial();

    var mesh1 = new THREE.Mesh(geometry, material);
    game.add(mesh1);
    var mesh2 = new THREE.Mesh(geometry, material);
    mesh2.position.set(0,1,0);
    game.add(mesh2);

    renderer = new THREE.WebGLRenderer();
    renderer.setSize(container.clientWidth, container.clientHeight);
    renderer.setPixelRatio(window.devicePixelRatio);
    container.appendChild(renderer.domElement);

    renderer.setAnimationLoop(() => {
        renderer.render(scene, camera);
    });
}

init();

ObjectControls.js

THREE.ObjectControls = function (camera, domElement, objectToMove) {
    mesh = objectToMove;
    domElement.addEventListener('mousemove', mouseMove, false);

    function mouseMove(e) {
        //** objectToMove is undefined :( **
        mesh.rotation.y += 3;
    }
};

Expected result is that the entire THREE.Group() game will be rotated, but the result that I get is that only the first child of game is rotated, in this case mesh1.

Body:
controls = new THREE.ObjectControls(camera, container, game);
game = new THREE.Group();

There is an error in your code since you pass the undefined variable game to the ctor of ObjectControls. If you assign a new object to game one line later, ObjectControls does not have a reference to this variable.

The idea is to assign the group object to game first and then create ObjectControls. You essentially switch both lines.

three.js R105


问:
Jenkinsfile with globaly defined manager produce error if I pass manager instance outside of pipeline
I want to pass notifications in few slack channels.
Jenkinsfile:

```<code>def mng = manager

def notifyOnError(msg){
    def attachments = [
      [
        text: msg,
        color: '#ff0000'
      ]
    ]
    slackSend(channel: '#errors', attachments: attachments, tokenCredentialId: 'Slack')
    slackSend(channel: '#general', attachments: attachments, tokenCredentialId: 'Slack')
}

pipeline {
  agent any
  stages {
    stage('error') {
      steps {
        sh missed  // raise error
      }
    }
  }
  post {
    success {
      slackSend channel: '#general', color: 'good', message: "Build: <${env.BUILD_URL}|${env.JOB_NAME} Complete", tokenCredentialId: 'Slack'
    }
    unsuccessful {
      echo(mng.build.result.toString())
      notifyOnError("Build <${env.BUILD_URL}|${env.JOB_NAME} #${env.BUILD_NUMBER}> ${mng.build.result.toString()}")
    }
  }
}
</code>```

and I got this in pipeline.log:

```Push event to branch both
Connecting to https://api.github.com using im/****** (GitHub Access Token)
Obtained Jenkinsfile from f30010e52c041d3497229c8d746c348fc43b793a
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/ci-test_both
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
using credential github
 > git rev-parse --is-inside-work-tree # timeout=10
[Pipeline] echo
FAILURE
[Pipeline] slackSend
Slack Send Pipeline step running, values are - baseUrl: <empty>, teamDomain: agblox-workspace, channel: #errors, color: <empty>, botUser: false, tokenCredentialId: Slack
[Pipeline] }
Error when executing unsuccessful post condition:
java.io.NotSerializableException: org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder$BadgeManager
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:926)
    at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
    at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
    at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
    at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
    at java.util.HashMap.internalWriteEntries(HashMap.java:1793)
    at java.util.HashMap.writeObject(HashMap.java:1363)
    at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)

    at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
    at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
--------skipped due SO message size limit ------
    at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
    at java.util.HashMap.internalWriteEntries(HashMap.java:1793)
    at java.util.HashMap.writeObject(HashMap.java:1363)
    at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)
    at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
    at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
    at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.lambda$writeObject$0(RiverWriter.java:144)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:241)
    at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:143)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:500)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:476)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:463)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:387)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:259)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:247)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: an exception which occurred:
    in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@7ca2827d
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@32344197
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@40455508
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@1487f4f1
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@4f9801bc
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.TryBlockEnv@2c7bdf08
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@323cd55c
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@257775d6
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@278d4f1d
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@4871dd10
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@38e48a82
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@33887dab
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@5b170b7c
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@c142ef
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@22ef2c5f
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@be0c435
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@21ce7eea
    in field com.cloudbees.groovy.cps.impl.CpsClosureDef.capture
    in object com.cloudbees.groovy.cps.impl.CpsClosureDef@4676aaab
    in field com.cloudbees.groovy.cps.impl.CpsClosure.def
    in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@48b674b9
    in field groovy.lang.Closure.delegate
    in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@7908c9f3
    in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.closures
    in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@14606e52
    in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@14606e52

[Pipeline] }
[Pipeline] }
[Pipeline] End of Pipeline

GitHub has been notified of this commit’s build result

an exception which occurred:
    in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@7ca2827d
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@32344197
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@40455508
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@1487f4f1
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@4f9801bc
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.TryBlockEnv@2c7bdf08
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@323cd55c
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@257775d6
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@278d4f1d
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@4871dd10
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@38e48a82
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@33887dab
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@5b170b7c
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@c142ef
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@22ef2c5f
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@be0c435
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@21ce7eea
    in field com.cloudbees.groovy.cps.impl.CpsClosureDef.capture
    in object com.cloudbees.groovy.cps.impl.CpsClosureDef@4676aaab
    in field com.cloudbees.groovy.cps.impl.CpsClosure.def
    in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@48b674b9
    in field groovy.lang.Closure.delegate
    in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@7908c9f3
    in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.closures
    in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@14606e52
    in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@14606e52
Caused: java.io.NotSerializableException: org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder$BadgeManager
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:926)
    at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
    at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
    at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
    at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
    at java.util.HashMap.internalWriteEntries(HashMap.java:1793)
    at java.util.HashMap.writeObject(HashMap.java:1363)
    at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)
    at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
    at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
    at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
    at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
    at java.util.HashMap.internalWriteEntries(HashMap.java:1793)
    at java.util.HashMap.writeObject(HashMap.java:1363)
    at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)
    at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
    at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
    at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.lambda$writeObject$0(RiverWriter.java:144)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:241)
    at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:143)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:500)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:476)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:463)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:387)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:259)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:247)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
```

message been sent only to first channel and pipeline crashed. Without declaring def mng = manager all ok, but i want to pass build status. How  can I do it?

答:
The Pipeline script:

```<code>   pipeline {
        agent any
        post {
          always {
            echo a
          }
        }
        stages {
            stage('declaration') {
                steps {
                    script {
                        a = "b"
                    }
                }
            }
        }
    }
</code>```

Console output:

```<code>Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /home/quan/.jenkins/workspace/My pipeline
[Pipeline] {
[Pipeline] stage
[Pipeline] { (declaration)
[Pipeline] script
[Pipeline] {
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
b
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
</code>```

It turns out the variable in previous stage is still 'live' in later stage. Important : a = 'b' not def a = 'b' The latter invoked error.

Body:
I want to pass notifications in few slack channels.
Jenkinsfile:

def mng = manager

def notifyOnError(msg){
    def attachments = [
      [
        text: msg,
        color: '#ff0000'
      ]
    ]
    slackSend(channel: '#errors', attachments: attachments, tokenCredentialId: 'Slack')
    slackSend(channel: '#general', attachments: attachments, tokenCredentialId: 'Slack')
}

pipeline {
  agent any
  stages {
    stage('error') {
      steps {
        sh missed  // raise error
      }
    }
  }
  post {
    success {
      slackSend channel: '#general', color: 'good', message: "Build: <${env.BUILD_URL}|${env.JOB_NAME} Complete", tokenCredentialId: 'Slack'
    }
    unsuccessful {
      echo(mng.build.result.toString())
      notifyOnError("Build <${env.BUILD_URL}|${env.JOB_NAME} #${env.BUILD_NUMBER}> ${mng.build.result.toString()}")
    }
  }
}

and I got this in pipeline.log:

Push event to branch both
Connecting to https://api.github.com using im/****** (GitHub Access Token)
Obtained Jenkinsfile from f30010e52c041d3497229c8d746c348fc43b793a
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/ci-test_both
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
using credential github
 > git rev-parse --is-inside-work-tree # timeout=10
[Pipeline] echo
FAILURE
[Pipeline] slackSend
Slack Send Pipeline step running, values are - baseUrl: <empty>, teamDomain: agblox-workspace, channel: #errors, color: <empty>, botUser: false, tokenCredentialId: Slack
[Pipeline] }
Error when executing unsuccessful post condition:
java.io.NotSerializableException: org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder$BadgeManager
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:926)
    at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
    at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
    at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
    at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
    at java.util.HashMap.internalWriteEntries(HashMap.java:1793)
    at java.util.HashMap.writeObject(HashMap.java:1363)
    at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)

    at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
    at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
--------skipped due SO message size limit ------
    at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
    at java.util.HashMap.internalWriteEntries(HashMap.java:1793)
    at java.util.HashMap.writeObject(HashMap.java:1363)
    at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)
    at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
    at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
    at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.lambda$writeObject$0(RiverWriter.java:144)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:241)
    at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:143)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:500)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:476)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:463)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:387)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:259)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:247)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: an exception which occurred:
    in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@7ca2827d
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@32344197
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@40455508
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@1487f4f1
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@4f9801bc
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.TryBlockEnv@2c7bdf08
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@323cd55c
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@257775d6
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@278d4f1d
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@4871dd10
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@38e48a82
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@33887dab
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@5b170b7c
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@c142ef
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@22ef2c5f
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@be0c435
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@21ce7eea
    in field com.cloudbees.groovy.cps.impl.CpsClosureDef.capture
    in object com.cloudbees.groovy.cps.impl.CpsClosureDef@4676aaab
    in field com.cloudbees.groovy.cps.impl.CpsClosure.def
    in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@48b674b9
    in field groovy.lang.Closure.delegate
    in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@7908c9f3
    in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.closures
    in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@14606e52
    in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@14606e52

[Pipeline] }
[Pipeline] }
[Pipeline] End of Pipeline

GitHub has been notified of this commit’s build result

an exception which occurred:
    in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@7ca2827d
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@32344197
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@40455508
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@1487f4f1
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@4f9801bc
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.TryBlockEnv@2c7bdf08
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@323cd55c
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@257775d6
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@278d4f1d
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@4871dd10
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@38e48a82
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@33887dab
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@5b170b7c
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@c142ef
    in field com.cloudbees.groovy.cps.impl.CallEnv.caller
    in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@22ef2c5f
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@be0c435
    in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
    in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@21ce7eea
    in field com.cloudbees.groovy.cps.impl.CpsClosureDef.capture
    in object com.cloudbees.groovy.cps.impl.CpsClosureDef@4676aaab
    in field com.cloudbees.groovy.cps.impl.CpsClosure.def
    in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@48b674b9
    in field groovy.lang.Closure.delegate
    in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@7908c9f3
    in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.closures
    in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@14606e52
    in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@14606e52
Caused: java.io.NotSerializableException: org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder$BadgeManager
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:926)
    at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
    at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
    at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
    at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
    at java.util.HashMap.internalWriteEntries(HashMap.java:1793)
    at java.util.HashMap.writeObject(HashMap.java:1363)
    at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)
    at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
    at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
    at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
    at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
    at java.util.HashMap.internalWriteEntries(HashMap.java:1793)
    at java.util.HashMap.writeObject(HashMap.java:1363)
    at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)
    at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
    at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
    at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
    at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.lambda$writeObject$0(RiverWriter.java:144)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:241)
    at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:143)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:500)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:476)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:463)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:387)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:259)
    at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:247)
    at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

message been sent only to first channel and pipeline crashed. Without declaring def mng = manager all ok, but i want to pass build status. How  can I do it?

Body:
The Pipeline script:

   pipeline {
        agent any
        post {
          always {
            echo a
          }
        }
        stages {
            stage('declaration') {
                steps {
                    script {
                        a = "b"
                    }
                }
            }
        }
    }

Console output:

Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /home/quan/.jenkins/workspace/My pipeline
[Pipeline] {
[Pipeline] stage
[Pipeline] { (declaration)
[Pipeline] script
[Pipeline] {
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
b
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

It turns out the variable in previous stage is still 'live' in later stage. Important : a = 'b' not def a = 'b' The latter invoked error.


问:
How can I get the format of an image?
I have an image in my drawable folder and I want to know which format it is. How can I do this?</p>

答:
Load into a Drawable object and analyse the run-time class of the Drawable.</p>

```<code>Drawable d = Ctxt.getDrawable(R.drawable.nnn);
if(d instanceof BitmapDrawable)
   //...
else if(d instanceof NinePatchDrawable)
  //...
</code>```

Title: How can I get the format of an image?

Body:
Load into a Drawable object and analyse the run-time class of the Drawable.

Drawable d = Ctxt.getDrawable(R.drawable.nnn);
if(d instanceof BitmapDrawable)
   //...
else if(d instanceof NinePatchDrawable)
  //...